( state: CommandState, input: string, ctx: TransitionContext, )
| 57 | * Main transition function. Dispatches based on current state type. |
| 58 | */ |
| 59 | export function transition( |
| 60 | state: CommandState, |
| 61 | input: string, |
| 62 | ctx: TransitionContext, |
| 63 | ): TransitionResult { |
| 64 | switch (state.type) { |
| 65 | case 'idle': |
| 66 | return fromIdle(input, ctx) |
| 67 | case 'count': |
| 68 | return fromCount(state, input, ctx) |
| 69 | case 'operator': |
| 70 | return fromOperator(state, input, ctx) |
| 71 | case 'operatorCount': |
| 72 | return fromOperatorCount(state, input, ctx) |
| 73 | case 'operatorFind': |
| 74 | return fromOperatorFind(state, input, ctx) |
| 75 | case 'operatorTextObj': |
| 76 | return fromOperatorTextObj(state, input, ctx) |
| 77 | case 'find': |
| 78 | return fromFind(state, input, ctx) |
| 79 | case 'g': |
| 80 | return fromG(state, input, ctx) |
| 81 | case 'operatorG': |
| 82 | return fromOperatorG(state, input, ctx) |
| 83 | case 'replace': |
| 84 | return fromReplace(state, input, ctx) |
| 85 | case 'indent': |
| 86 | return fromIndent(state, input, ctx) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | // ============================================================================ |
| 91 | // Shared Input Handling |
no test coverage detected