(
state: { type: 'count'; digits: string },
input: string,
ctx: TransitionContext,
)
| 263 | } |
| 264 | |
| 265 | function fromCount( |
| 266 | state: { type: 'count'; digits: string }, |
| 267 | input: string, |
| 268 | ctx: TransitionContext, |
| 269 | ): TransitionResult { |
| 270 | if (/[0-9]/.test(input)) { |
| 271 | const newDigits = state.digits + input |
| 272 | const count = Math.min(parseInt(newDigits, 10), MAX_VIM_COUNT) |
| 273 | return { next: { type: 'count', digits: String(count) } } |
| 274 | } |
| 275 | |
| 276 | const count = parseInt(state.digits, 10) |
| 277 | const result = handleNormalInput(input, count, ctx) |
| 278 | if (result) return result |
| 279 | |
| 280 | return { next: { type: 'idle' } } |
| 281 | } |
| 282 | |
| 283 | function fromOperator( |
| 284 | state: { type: 'operator'; op: Operator; count: number }, |
no test coverage detected