(options: SelectOptionsReq<A>)
| 3637 | }) |
| 3638 | |
| 3639 | const handleSelectProcess = <A>(options: SelectOptionsReq<A>) => { |
| 3640 | return (input: Terminal.UserInput, state: SelectState) => { |
| 3641 | switch (input.key.name) { |
| 3642 | case "k": |
| 3643 | case "up": { |
| 3644 | return processSelectCursorUp(state, options.choices) |
| 3645 | } |
| 3646 | case "j": |
| 3647 | case "down": { |
| 3648 | return processSelectCursorDown(state, options.choices) |
| 3649 | } |
| 3650 | case "tab": { |
| 3651 | return processSelectNext(state, options.choices) |
| 3652 | } |
| 3653 | case "enter": |
| 3654 | case "return": { |
| 3655 | const selected = options.choices[state] |
| 3656 | if (selected.disabled) { |
| 3657 | return Effect.succeed(Action.Beep()) |
| 3658 | } |
| 3659 | return Effect.succeed(Action.Submit({ value: selected.value })) |
| 3660 | } |
| 3661 | default: { |
| 3662 | return Effect.succeed(Action.Beep()) |
| 3663 | } |
| 3664 | } |
| 3665 | } |
| 3666 | } |
| 3667 | |
| 3668 | const handleAutoCompleteProcess = <A>(options: AutoCompleteOptionsReq<A>) => { |
| 3669 | return (input: Terminal.UserInput, state: AutoCompleteState) => { |
no test coverage detected