diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-26 22:22:02 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-26 22:22:02 +0200 |
| commit | 39a11ed5997a3829751dfbe4b666d3568d466276 (patch) | |
| tree | de48f2661fe5986c61d91373737d452eff660757 /internal/tui/tui.go | |
| parent | 21e713c3006d1295cbc68cecef90b54659fc1720 (diff) | |
tui: add shortcut to reselect pid and restart tracing
Diffstat (limited to 'internal/tui/tui.go')
| -rw-r--r-- | internal/tui/tui.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/tui/tui.go b/internal/tui/tui.go index db810b2..032a27a 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -236,6 +236,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.probeModal = probes.NewModel(getProbeManager()).Open() return m, nil } + if m.screen == ScreenDashboard && !m.attaching && m.lastErr == nil && key.Matches(msg, m.keys.SelectPID) && !m.exporter.Visible() && !m.probeModal.Visible() && !m.dashboard.BlocksGlobalShortcuts() { + return m.reselectPID() + } case tuiexport.RequestMsg: return m, runExportCmd(msg.Option, m.dashboard.LatestSnapshot()) case tuiexport.CompletedMsg: @@ -325,6 +328,26 @@ func (m Model) handlePidSelected(msg PidSelectedMsg) (tea.Model, tea.Cmd) { return m, tea.Batch(m.spin.Tick, m.beginTraceCmd()) } +func (m Model) reselectPID() (tea.Model, tea.Cmd) { + m.stopTrace() + m.screen = ScreenPIDPicker + m.attaching = false + m.lastErr = nil + m.showHelp = false + m.exporter = tuiexport.NewModel() + m.probeModal = probes.NewModel(getProbeManager()) + m.pidPicker = pidpicker.New() + + var sizeCmd tea.Cmd + if m.width > 0 && m.height > 0 { + msg := tea.WindowSizeMsg{Width: m.width, Height: m.height} + next, cmd := m.pidPicker.Update(msg) + m.pidPicker = next.(pidpicker.Model) + sizeCmd = cmd + } + return m, tea.Batch(sizeCmd, m.pidPicker.Init()) +} + func selectedPIDFilter(pid int) int { if pid <= 0 { return -1 |
