* Handle operator input (motion, find, text object scope). * Returns null if input is not recognized.
( op: Operator, count: number, input: string, ctx: TransitionContext, )
| 204 | * Returns null if input is not recognized. |
| 205 | */ |
| 206 | function handleOperatorInput( |
| 207 | op: Operator, |
| 208 | count: number, |
| 209 | input: string, |
| 210 | ctx: TransitionContext, |
| 211 | ): TransitionResult | null { |
| 212 | if (isTextObjScopeKey(input)) { |
| 213 | return { |
| 214 | next: { |
| 215 | type: 'operatorTextObj', |
| 216 | op, |
| 217 | count, |
| 218 | scope: TEXT_OBJ_SCOPES[input], |
| 219 | }, |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | if (FIND_KEYS.has(input)) { |
| 224 | return { |
| 225 | next: { type: 'operatorFind', op, count, find: input as FindType }, |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | if (SIMPLE_MOTIONS.has(input)) { |
| 230 | return { execute: () => executeOperatorMotion(op, input, count, ctx) } |
| 231 | } |
| 232 | |
| 233 | if (input === 'G') { |
| 234 | return { execute: () => executeOperatorG(op, count, ctx) } |
| 235 | } |
| 236 | |
| 237 | if (input === 'g') { |
| 238 | return { next: { type: 'operatorG', op, count } } |
| 239 | } |
| 240 | |
| 241 | return null |
| 242 | } |
| 243 | |
| 244 | // ============================================================================ |
| 245 | // Transition Functions - One per state type |
no test coverage detected