handleQuitConfirmKeys handles keyboard input for the quit confirmation dialog.
(msg tea.KeyMsg)
| 881 | |
| 882 | // handleQuitConfirmKeys handles keyboard input for the quit confirmation dialog. |
| 883 | func (a App) handleQuitConfirmKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { |
| 884 | switch msg.String() { |
| 885 | case "esc": |
| 886 | a.viewMode = a.previousViewMode |
| 887 | return a, nil |
| 888 | case "up", "k": |
| 889 | a.quitConfirm.MoveUp() |
| 890 | return a, nil |
| 891 | case "down", "j": |
| 892 | a.quitConfirm.MoveDown() |
| 893 | return a, nil |
| 894 | case "enter": |
| 895 | if a.quitConfirm.GetSelected() == QuitOptionQuit { |
| 896 | a.stopAllLoops() |
| 897 | a.stopWatcher() |
| 898 | return a, tea.Quit |
| 899 | } |
| 900 | // Cancel |
| 901 | a.viewMode = a.previousViewMode |
| 902 | return a, nil |
| 903 | } |
| 904 | return a, nil |
| 905 | } |
| 906 | |
| 907 | // renderQuitConfirmView renders the quit confirmation dialog. |
| 908 | func (a *App) renderQuitConfirmView() string { |
no test coverage detected