diff options
Diffstat (limited to 'internal/tui/history_box.go')
-rw-r--r-- | internal/tui/history_box.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/tui/history_box.go b/internal/tui/history_box.go index c5c045e..01ea59b 100644 --- a/internal/tui/history_box.go +++ b/internal/tui/history_box.go @@ -401,6 +401,15 @@ func (m *HistoryBoxModel) changeSelection(forward bool) { } } +func (m *HistoryBoxModel) changeSelectionToEnd(top bool) { + switch m.viewLevel { + case HistoryLevelSummary: + m.changeSummarySelectionToEnd(top) + case HistoryLevelDetails: + m.changeDetailsSelectionToEnd(top) + } +} + func (m *HistoryBoxModel) changeSummarySelection(forward bool) { newIdx := m.summarySelection if forward { @@ -416,6 +425,14 @@ func (m *HistoryBoxModel) changeSummarySelection(forward bool) { } } +func (m *HistoryBoxModel) changeSummarySelectionToEnd(top bool) { + if top { + m.summarySelection = 0 + } else { + m.summarySelection = len(m.summaryItems) - 1 + } +} + func (m *HistoryBoxModel) changeDetailsSelection(forward bool) { newIdx := m.detailSelection entries := m.selectedEntries() @@ -432,6 +449,14 @@ func (m *HistoryBoxModel) changeDetailsSelection(forward bool) { } } +func (m *HistoryBoxModel) changeDetailsSelectionToEnd(top bool) { + if top { + m.detailSelection = 0 + } else { + m.detailSelection = len(m.selectedEntries()) - 1 + } +} + func (m HistoryBoxModel) selectedEntry() queries.TimeEntry { if m.viewLevel != HistoryLevelDetails { panic("fetching selected entry in history summary level") |