summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-08 22:41:22 +0200
committerPaul Buetow <paul@buetow.org>2026-03-08 22:41:22 +0200
commit70073d81e1e384f827a2ab34c27723a2862bbb84 (patch)
tree46cd3be55811575036a2f08e77500e35c6e304a0
parentfd801e7e3ff07d44701eb2e53a3b0764b504983d (diff)
tui: reserve p for pid picker
-rw-r--r--internal/tui/flamegraph/controls.go4
-rw-r--r--internal/tui/flamegraph/model.go2
-rw-r--r--internal/tui/flamegraph/model_test.go10
-rw-r--r--internal/tui/tui.go2
-rw-r--r--internal/tui/tui_test.go20
5 files changed, 27 insertions, 11 deletions
diff --git a/internal/tui/flamegraph/controls.go b/internal/tui/flamegraph/controls.go
index 37b030a..2033416 100644
--- a/internal/tui/flamegraph/controls.go
+++ b/internal/tui/flamegraph/controls.go
@@ -82,7 +82,7 @@ func (m Model) toolbarLine() string {
state = lipgloss.NewStyle().Foreground(common.ColorDanger).Bold(true).Render("[PAUSED]")
}
order := m.currentFieldPresetLabel()
- line := fmt.Sprintf("%s | view:%s | o:order(%s) | b:metric(%s) | /:search | enter/click:zoom | click ancestor:undo | u/esc:undo | r:reset | space/p:pause", state, compactFramePath(m.currentRootPath()), order, m.countFieldLabel())
+ line := fmt.Sprintf("%s | view:%s | o:order(%s) | b:metric(%s) | /:search | enter/click:zoom | click ancestor:undo | u/esc:undo | r:reset | space:pause", state, compactFramePath(m.currentRootPath()), order, m.countFieldLabel())
if m.searchQuery != "" {
line += " | filter:" + m.searchQuery
}
@@ -104,7 +104,7 @@ func (m Model) helpOverlay() string {
if width <= 0 {
width = 80
}
- help := "Flame help: j/k depth h/l sibling pgup top pgdn root enter/click zoom click ancestor undo u/backspace/esc undo / search n/N matches space/p pause r reset baseline o order b metric ? help"
+ help := "Flame help: j/k depth h/l sibling pgup top pgdn root enter/click zoom click ancestor undo u/backspace/esc undo / search n/N matches space pause r reset baseline o order b metric ? help"
return common.HelpBarStyle.Width(width).Render(padOrTrim(help, width))
}
diff --git a/internal/tui/flamegraph/model.go b/internal/tui/flamegraph/model.go
index 9c7bac5..6f5411b 100644
--- a/internal/tui/flamegraph/model.go
+++ b/internal/tui/flamegraph/model.go
@@ -937,7 +937,7 @@ func isNextMatchKey(msg tea.KeyPressMsg) bool { return keyString(msg) == "n" }
func isPrevMatchKey(msg tea.KeyPressMsg) bool { return keyString(msg) == "N" }
func isPauseKey(msg tea.KeyPressMsg) bool {
k := keyString(msg)
- return k == "p" || k == " " || k == "space" || msg.Code == tea.KeySpace
+ return k == " " || k == "space" || msg.Code == tea.KeySpace
}
func isResetBaselineKey(msg tea.KeyPressMsg) bool {
return keyString(msg) == "r"
diff --git a/internal/tui/flamegraph/model_test.go b/internal/tui/flamegraph/model_test.go
index 59130ec..d87ae54 100644
--- a/internal/tui/flamegraph/model_test.go
+++ b/internal/tui/flamegraph/model_test.go
@@ -747,21 +747,17 @@ func TestSearchSubmitSetsFilterStatusMessage(t *testing.T) {
func TestControlPauseToggle(t *testing.T) {
m := NewModel(nil)
- m = pressFlameKey(t, m, tea.KeyPressMsg{Code: []rune{'p'}[0], Text: "p"})
+ m = pressFlameKey(t, m, tea.KeyPressMsg{Code: tea.KeySpace, Text: " "})
if !m.paused {
- t.Fatalf("expected pause to toggle on")
+ t.Fatalf("expected space key to toggle pause on")
}
m = pressFlameKey(t, m, tea.KeyPressMsg{Code: tea.KeySpace, Text: " "})
if m.paused {
t.Fatalf("expected space key to toggle pause off")
}
- m = pressFlameKey(t, m, tea.KeyPressMsg{Code: tea.KeySpace, Text: " "})
- if !m.paused {
- t.Fatalf("expected space key to toggle pause on")
- }
m = pressFlameKey(t, m, tea.KeyPressMsg{Code: []rune{'p'}[0], Text: "p"})
if m.paused {
- t.Fatalf("expected p key to toggle pause off")
+ t.Fatalf("expected p key not to toggle pause")
}
}
diff --git a/internal/tui/tui.go b/internal/tui/tui.go
index 3e14060..fcdede9 100644
--- a/internal/tui/tui.go
+++ b/internal/tui/tui.go
@@ -1227,7 +1227,7 @@ func (m Model) helpSections() []helpSection {
"sys/proc: v bubbles b metric events/bytes",
"files: d dirs toggle v bubbles (dirs only) b metric",
"flame: arrows/hjkl nav enter/click zoom click ancestor undo u/bs/esc undo o order",
- "flame: / filter n/N match next/prev space/p pause b metric",
+ "flame: / filter n/N match next/prev space pause b metric",
"stream: space pause enter push filter esc/F undo /? n/N search",
"stream: x/X export E open",
},
diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go
index 2d5419a..8e80860 100644
--- a/internal/tui/tui_test.go
+++ b/internal/tui/tui_test.go
@@ -643,6 +643,26 @@ func TestFlamePauseKeyDoesNotTriggerPIDReselect(t *testing.T) {
}
}
+func TestFlamePIDShortcutOpensPIDPickerInsteadOfPausing(t *testing.T) {
+ m := NewModel(-1, func(context.Context) error { return nil })
+ m.screen = ScreenDashboard
+ m.attaching = false
+ m.width = 120
+ m.height = 30
+
+ next, cmd := m.Update(tea.KeyPressMsg{Code: []rune{'p'}[0], Text: "p"})
+ updated := next.(Model)
+ if updated.screen != ScreenPIDPicker {
+ t.Fatalf("expected p to open PID picker from flame tab, got %v", updated.screen)
+ }
+ if strings.Contains(updated.View().Content, "[PAUSED]") {
+ t.Fatalf("expected p not to pause flame tab")
+ }
+ if cmd == nil {
+ t.Fatalf("expected picker init command on p")
+ }
+}
+
func TestFlameSpaceKeyReleaseFallbackTogglesPause(t *testing.T) {
m := NewModel(-1, func(context.Context) error { return nil })
m.screen = ScreenDashboard