diff --git a/internal/tui/components/app/app.go b/internal/tui/components/app/app.go index ccb8a54a..16fefade 100644 --- a/internal/tui/components/app/app.go +++ b/internal/tui/components/app/app.go @@ -366,7 +366,8 @@ func (m *Model) handleKeyMsg(msg tea.KeyMsg) tea.Cmd { saving := m.currentPageViewportSaving() enteringInput := currentPageModel != nil && currentPageModel.EnteringInput() typingQLegitimately := msg.String() == "q" && (addingQToFilter || saving || enteringInput || m.inPty) - if !typingQLegitimately || m.err != nil { + ctrlCInPty := m.inPty && msg.String() == "ctrl+c" + if (!ctrlCInPty && !typingQLegitimately) || m.err != nil { return m.cleanupCmd() } } diff --git a/internal/tui/nomad/exec.go b/internal/tui/nomad/exec.go index 083fc9c4..37b9dad3 100644 --- a/internal/tui/nomad/exec.go +++ b/internal/tui/nomad/exec.go @@ -136,6 +136,8 @@ func GetKeypress(msg tea.KeyMsg) (keypress string) { } case tea.KeyCtrlD: keypress = string(rune(4)) + case tea.KeyCtrlC: + keypress = string(rune(3)) case tea.KeyTab: keypress = string(rune(9)) case tea.KeyUp: diff --git a/internal/tui/nomad/pages.go b/internal/tui/nomad/pages.go index c20f3eb4..f9d58f96 100644 --- a/internal/tui/nomad/pages.go +++ b/internal/tui/nomad/pages.go @@ -385,6 +385,12 @@ func GetPageKeyHelp( changeKeyHelp(&keymap.KeyMap.Compact, "compact") } + if filterFocused || enteringInput { + keymap.KeyMap.Exit.SetHelp("ctrl+c", "exit") + } else { + keymap.KeyMap.Exit.SetHelp("q/ctrl+c", "exit") + } + firstRow := []key.Binding{keymap.KeyMap.Exit} if !saving && !filterFocused { @@ -446,8 +452,7 @@ func GetPageKeyHelp( } if inPty { changeKeyHelp(&keymap.KeyMap.Back, "disable input") - secondRow = []key.Binding{keymap.KeyMap.Back} - return getShortHelp(firstRow) + "\n" + getShortHelp(secondRow) + return getShortHelp([]key.Binding{keymap.KeyMap.Back}) } else { if webSocketConnected { changeKeyHelp(&keymap.KeyMap.Forward, "enable input")