From 1a094b919cf66c2c3643e621c0c0af3bf1c90fd9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 25 Feb 2026 10:23:16 +0200 Subject: Toggle files directory grouping with d key --- internal/tui/dashboard/model.go | 5 +++++ internal/tui/dashboard/model_test.go | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go index 822f88f..1a770f3 100644 --- a/internal/tui/dashboard/model.go +++ b/internal/tui/dashboard/model.go @@ -138,6 +138,11 @@ func (m Model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { snap := m.snapshot() cmd = func() tea.Msg { return messages.StatsTickMsg{Snap: snap} } handled = true + case key.Matches(msg, m.keys.DirGroup): + if m.activeTab == TabFiles { + m.filesDirGrouped = !m.filesDirGrouped + handled = true + } } } if !handled { diff --git a/internal/tui/dashboard/model_test.go b/internal/tui/dashboard/model_test.go index 29b698d..1f479ab 100644 --- a/internal/tui/dashboard/model_test.go +++ b/internal/tui/dashboard/model_test.go @@ -140,6 +140,24 @@ func TestFilesTabScrollsWithJK(t *testing.T) { } } +func TestDirGroupKeyTogglesOnlyOnFilesTab(t *testing.T) { + m := NewModelWithConfig(nil, nil, 250, common.DefaultKeyMap()) + m.activeTab = TabFiles + + next, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'d'}}) + model := next.(Model) + if !model.filesDirGrouped { + t.Fatalf("expected filesDirGrouped to toggle on files tab") + } + + model.activeTab = TabOverview + next, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'d'}}) + model = next.(Model) + if !model.filesDirGrouped { + t.Fatalf("expected filesDirGrouped unchanged outside files tab") + } +} + func TestScrollOffsetDoesNotGrowUnbounded(t *testing.T) { m := NewModelWithConfig(nil, nil, 250, common.DefaultKeyMap()) m.activeTab = TabSyscalls -- cgit v1.2.3