summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/tui/tui.go14
-rw-r--r--internal/tui/tui_test.go6
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) {