diff options
author | T <t@tjp.lol> | 2025-09-02 12:22:31 -0600 |
---|---|---|
committer | T <t@tjp.lol> | 2025-09-02 12:24:05 -0600 |
commit | 746ac3c29cad01f99f19c58e66dff4a02819704a (patch) | |
tree | f2a047b7f86689b4cfbba3fd7da02a1be5f35a0d /internal | |
parent | d6dfc913fcca4f25e8d5454a03aa559811fba9ab (diff) |
history pane: reset selection indices on filter criteria changes
Diffstat (limited to 'internal')
-rw-r--r-- | internal/tui/app.go | 2 | ||||
-rw-r--r-- | internal/tui/history_box.go | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/internal/tui/app.go b/internal/tui/app.go index 6031adb..fe5f364 100644 --- a/internal/tui/app.go +++ b/internal/tui/app.go @@ -219,6 +219,7 @@ func (m AppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case updateHistoryFilter: m.historyBox.filter = HistoryFilter(msg) + m.historyBox.resetSelection() cmds = append(cmds, m.refreshCmd) case openReportModal: @@ -245,6 +246,7 @@ func (m *AppModel) filterHistoryByProjectBox() { } else { m.historyBox.filter.ProjectID = nil } + m.historyBox.resetSelection() } func (m *AppModel) openEntryEditor() { diff --git a/internal/tui/history_box.go b/internal/tui/history_box.go index 6856a63..760926e 100644 --- a/internal/tui/history_box.go +++ b/internal/tui/history_box.go @@ -543,6 +543,11 @@ func (m *HistoryBoxModel) recheckBounds() { } } +func (m *HistoryBoxModel) resetSelection() { + m.summarySelection = 0 + m.detailSelection = 0 +} + // formatFilterInfo formats the filter criteria line showing client/project, time range, and total duration func (m HistoryBoxModel) formatFilterInfo(clients []queries.Client, projects map[int64][]queries.Project, timer TimerBoxModel) string { var parts []string |