diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-06 18:12:39 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-06 18:12:39 +0200 |
| commit | b566bc141e971ae2a7634c9d836f2ad8b0a62402 (patch) | |
| tree | 111aa195010261c59ae6f53eafa30e9edfbbd212 /internal/tui/tui.go | |
| parent | 99a6cf4787fd92a25a53acbc9c0bae8bca87cc96 (diff) | |
fix(tui): close help overlay on q instead of quitting
Diffstat (limited to 'internal/tui/tui.go')
| -rw-r--r-- | internal/tui/tui.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 09b69e5..6b58ab3 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -421,17 +421,17 @@ func (m Model) canHandleDashboardShortcut(msg tea.KeyPressMsg) bool { } func (m Model) handleGlobalKeyPress(msg tea.KeyPressMsg) (tea.Model, tea.Cmd, bool) { - if key.Matches(msg, m.keys.Quit) { - m.quitting = true - m.stopTrace() - return m, tea.Quit, true - } if m.helpOverlayVisible { - if isHelpOverlayCloseKey(msg) || isHelpOverlayOpenKey(msg) { + if isHelpOverlayQuitKey(msg) || isHelpOverlayCloseKey(msg) || isHelpOverlayOpenKey(msg) { m.helpOverlayVisible = false } return m, nil, true } + if key.Matches(msg, m.keys.Quit) { + m.quitting = true + m.stopTrace() + return m, tea.Quit, true + } if isHelpOverlayOpenKey(msg) && !m.attaching && m.lastErr == nil { m.helpOverlayVisible = true return m, nil, true @@ -780,6 +780,10 @@ func isHelpOverlayCloseKey(msg tea.KeyPressMsg) bool { return msg.Code == tea.KeyEsc || msg.String() == "esc" || msg.String() == "?" } +func isHelpOverlayQuitKey(msg tea.KeyPressMsg) bool { + return msg.String() == "q" +} + func runExportCmd(exportEnabled bool, option tuiexport.Option, snap *statsengine.Snapshot) tea.Cmd { return func() tea.Msg { if !exportEnabled { @@ -843,7 +847,7 @@ func renderHelpOverlay(width, height int, groups [][]key.Binding) string { } lines = append(lines, strings.Join(parts, " • ")) } - lines = append(lines, "", "Esc/? close") + lines = append(lines, "", "Esc/?/q close") boxWidth := width - 6 if boxWidth < 72 { @@ -927,7 +931,7 @@ func renderGlobalHelpOverlay(width, height int, sections []helpSection) string { lines = append(lines, " "+truncateHelpLine(line, contentWidth-2)) } } - lines = append(lines, "", "Esc close") + lines = append(lines, "", "Esc/q close") maxLines := height - 4 if maxLines < 6 { |
