diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-25 22:58:40 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-25 22:58:40 +0200 |
| commit | 4c34b9efcd539c819648c927d7e3f53220df8ad2 (patch) | |
| tree | f9de9fd650a2d16316ba2c159990d891c9de5189 /internal/tui/probes | |
| parent | 67e10f34c92e93343adbd690b3b21e455e863bd3 (diff) | |
Fix stream paused scrolling and apply pending TUI/probe updates
Diffstat (limited to 'internal/tui/probes')
| -rw-r--r-- | internal/tui/probes/model.go | 4 | ||||
| -rw-r--r-- | internal/tui/probes/model_test.go | 41 |
2 files changed, 43 insertions, 2 deletions
diff --git a/internal/tui/probes/model.go b/internal/tui/probes/model.go index dffa30f..5cec2c7 100644 --- a/internal/tui/probes/model.go +++ b/internal/tui/probes/model.go @@ -117,9 +117,9 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { } return m, toggleCmd(m.manager, selected) case "a": - return m, bulkToggleCmd(m.manager, m.filtered(), false) + return m, bulkToggleCmd(m.manager, m.probes, false) case "n": - return m, bulkToggleCmd(m.manager, m.filtered(), true) + return m, bulkToggleCmd(m.manager, m.probes, true) } } return m, nil diff --git a/internal/tui/probes/model_test.go b/internal/tui/probes/model_test.go index 74f6a6b..73a83bc 100644 --- a/internal/tui/probes/model_test.go +++ b/internal/tui/probes/model_test.go @@ -78,3 +78,44 @@ func TestToggleEmitsProbeToggledMsg(t *testing.T) { } _ = next } + +func TestBulkKeysApplyGloballyNotOnlyFiltered(t *testing.T) { + fm := &fakeManager{ + states: []probemanager.ProbeState{ + {Syscall: "read", Active: true}, + {Syscall: "write", Active: true}, + {Syscall: "openat", Active: true}, + }, + } + m := NewModel(fm).Open() + m.search = "read" + + _, cmd := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'n'}}) + if cmd == nil { + t.Fatalf("expected bulk off command") + } + msg := cmd() + if toggled, ok := msg.(ProbeToggledMsg); !ok || toggled.Err != nil { + t.Fatalf("unexpected bulk off msg: %#v", msg) + } + if len(fm.toggles) != 3 { + t.Fatalf("expected all probes toggled off despite filter, got toggles=%+v", fm.toggles) + } + + // Re-open with all inactive and filtered search still present; "a" should + // toggle all probes back on. + m = NewModel(fm).Open() + m.search = "read" + fm.toggles = nil + _, cmd = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'a'}}) + if cmd == nil { + t.Fatalf("expected bulk on command") + } + msg = cmd() + if toggled, ok := msg.(ProbeToggledMsg); !ok || toggled.Err != nil { + t.Fatalf("unexpected bulk on msg: %#v", msg) + } + if len(fm.toggles) != 3 { + t.Fatalf("expected all probes toggled on despite filter, got toggles=%+v", fm.toggles) + } +} |
