diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-26 22:18:44 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-26 22:18:44 +0200 |
| commit | 0110c0568f7737c44db5f0134c376a978b5159b9 (patch) | |
| tree | 3e93959a875946582919d8357846b2e75cfddf46 /internal/tui | |
| parent | a5f53e8f5c90956f0aaed13aa79fc5ccb1d6bc15 (diff) | |
tui: fix and widen help overlay
Diffstat (limited to 'internal/tui')
| -rw-r--r-- | internal/tui/tui.go | 14 | ||||
| -rw-r--r-- | internal/tui/tui_test.go | 6 |
2 files changed, 17 insertions, 3 deletions
diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 5a8c14b..db810b2 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -385,7 +385,7 @@ func (m Model) View() string { return placeToViewport(width, height, m.exporter.View(width, height)+"\n"+base) } if m.showHelp { - return placeToViewport(width, height, renderHelpOverlay(width, height, [][]key.Binding{m.keys.PickerShortHelp()})+"\n"+base) + return placeToViewport(width, height, renderHelpOverlay(width, height, [][]key.Binding{m.keys.PickerShortHelp()})) } return placeToViewport(width, height, base) case ScreenDashboard: @@ -397,7 +397,7 @@ func (m Model) View() string { return placeToViewport(width, height, m.exporter.View(width, height)+"\n"+base) } if m.showHelp { - return placeToViewport(width, height, renderHelpOverlay(width, height, m.keys.DashboardFullHelp())+"\n"+base) + return placeToViewport(width, height, renderHelpOverlay(width, height, m.keys.DashboardFullHelp())) } return placeToViewport(width, height, base) default: @@ -550,8 +550,16 @@ func renderHelpOverlay(width, height int, groups [][]key.Binding) string { } lines = append(lines, "", "Esc/? close") + boxWidth := width - 6 + if boxWidth > 110 { + boxWidth = 110 + } + if boxWidth < 72 { + boxWidth = 72 + } + box := PanelStyle.Copy(). - Width(72). + Width(boxWidth). Render(strings.Join(lines, "\n")) return lipgloss.Place(width, height, lipgloss.Center, lipgloss.Center, box) diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go index 31a2e94..d9a69a5 100644 --- a/internal/tui/tui_test.go +++ b/internal/tui/tui_test.go @@ -385,6 +385,9 @@ func TestViewShowsHelpOverlay(t *testing.T) { if !strings.Contains(out, "tab next tab") { t.Fatalf("expected keybinding text in overlay") } + if strings.Contains(out, "Overview: waiting for stats") { + t.Fatalf("expected help overlay to render without stacking dashboard content") + } } func TestHelpOverlayBlocksUnderlyingActions(t *testing.T) { @@ -413,6 +416,9 @@ func TestHelpOverlayUsesPickerBindingsOnPickerScreen(t *testing.T) { if strings.Contains(out, "e export") { t.Fatalf("did not expect dashboard-only shortcut in picker help overlay") } + if strings.Contains(out, "Select PID to trace") { + t.Fatalf("expected help overlay to render without stacking picker content") + } } func TestHelpToggleDoesNotBreakExportModalInput(t *testing.T) { |
