(options: SelectOptionsReq<A>)
| 3392 | }) |
| 3393 | |
| 3394 | const handleSelectProcess = <A>(options: SelectOptionsReq<A>) => { |
| 3395 | return (input: Terminal.UserInput, state: SelectState) => { |
| 3396 | switch (input.key.name) { |
| 3397 | case "k": |
| 3398 | case "up": { |
| 3399 | return processSelectCursorUp(state, options.choices) |
| 3400 | } |
| 3401 | case "j": |
| 3402 | case "down": { |
| 3403 | return processSelectCursorDown(state, options.choices) |
| 3404 | } |
| 3405 | case "tab": { |
| 3406 | return processSelectNext(state, options.choices) |
| 3407 | } |
| 3408 | case "enter": |
| 3409 | case "return": { |
| 3410 | const selected = options.choices[state] |
| 3411 | if (selected.disabled) { |
| 3412 | return Effect.succeed(Action.Beep()) |
| 3413 | } |
| 3414 | return Effect.succeed(Action.Submit({ value: selected.value })) |
| 3415 | } |
| 3416 | default: { |
| 3417 | return Effect.succeed(Action.Beep()) |
| 3418 | } |
| 3419 | } |
| 3420 | } |
| 3421 | } |
| 3422 | |
| 3423 | const handleAutoCompleteProcess = <A>(options: AutoCompleteOptionsReq<A>) => { |
| 3424 | return (input: Terminal.UserInput, state: AutoCompleteState) => { |
no test coverage detected