diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-26 23:08:14 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-26 23:08:14 +0200 |
| commit | c3106802208b18f78d4ff4b22e1d889ac19f817f (patch) | |
| tree | c01fe438cf1d0699d7b08b919c3b5494ee18a32f /internal/tui/dashboard | |
| parent | dc7478d7dadf544787a9718608f11312bd2ea944 (diff) | |
tui: add paused stream column selection and split pid/tid
Diffstat (limited to 'internal/tui/dashboard')
| -rw-r--r-- | internal/tui/dashboard/model.go | 15 | ||||
| -rw-r--r-- | internal/tui/dashboard/model_test.go | 16 |
2 files changed, 9 insertions, 22 deletions
diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go index 026e63e..fae6a1b 100644 --- a/internal/tui/dashboard/model.go +++ b/internal/tui/dashboard/model.go @@ -107,7 +107,7 @@ func (m Model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { prevActiveTab := m.activeTab var cmd tea.Cmd keyStr := msg.String() - handled := m.handleArrowTabKey(keyStr) || m.handleScrollKey(msg) + handled := m.handleScrollKey(msg) if handled && m.activeTab == TabStream && (keyStr == " " || keyStr == "space") && !m.streamModel.Paused() { cmd = streamTickCmd() } @@ -164,19 +164,6 @@ func (m Model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { return m, cmd } -func (m *Model) handleArrowTabKey(keyStr string) bool { - switch keyStr { - case "right", "l": - m.activeTab = nextTab(m.activeTab) - return true - case "left", "h": - m.activeTab = prevTab(m.activeTab) - return true - default: - return false - } -} - func (m *Model) handleScrollKey(msg tea.KeyMsg) bool { keyStr := msg.String() switch m.activeTab { diff --git a/internal/tui/dashboard/model_test.go b/internal/tui/dashboard/model_test.go index a0e0539..37dbe28 100644 --- a/internal/tui/dashboard/model_test.go +++ b/internal/tui/dashboard/model_test.go @@ -59,31 +59,31 @@ func TestKeySwitchingChangesActiveTab(t *testing.T) { } } -func TestArrowAndViKeysCycleTabs(t *testing.T) { +func TestArrowAndViKeysDoNotCycleTabs(t *testing.T) { m := NewModelWithConfig(nil, nil, 250, common.DefaultKeyMap()) next, _ := m.Update(tea.KeyMsg{Type: tea.KeyRight}) model := next.(Model) - if model.activeTab != TabSyscalls { - t.Fatalf("expected right arrow to move to syscalls, got %v", model.activeTab) + if model.activeTab != TabOverview { + t.Fatalf("expected right arrow not to change tabs, got %v", model.activeTab) } next, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'l'}}) model = next.(Model) - if model.activeTab != TabFiles { - t.Fatalf("expected l to move to files, got %v", model.activeTab) + if model.activeTab != TabOverview { + t.Fatalf("expected l not to change tabs, got %v", model.activeTab) } next, _ = model.Update(tea.KeyMsg{Type: tea.KeyLeft}) model = next.(Model) - if model.activeTab != TabSyscalls { - t.Fatalf("expected left arrow to move back to syscalls, got %v", model.activeTab) + if model.activeTab != TabOverview { + t.Fatalf("expected left arrow not to change tabs, got %v", model.activeTab) } next, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'h'}}) model = next.(Model) if model.activeTab != TabOverview { - t.Fatalf("expected h to move back to overview, got %v", model.activeTab) + t.Fatalf("expected h not to change tabs, got %v", model.activeTab) } } |
