From 8cdd3c135e94cbda800896722b056b4d74454dd9 Mon Sep 17 00:00:00 2001 From: Cam Michie Date: Tue, 13 May 2025 12:52:48 +0100 Subject: [PATCH 1/8] add ability to sort by date with 'd' and sort by title with 't', and update minihelp view --- ui/sort.go | 65 +++++++++++++++++++++++++++++++++++++++++++++++-- ui/stash.go | 56 +++++++++++++++++++++++++++++++++--------- ui/stashhelp.go | 12 +++++++-- 3 files changed, 117 insertions(+), 16 deletions(-) diff --git a/ui/sort.go b/ui/sort.go index 4f389fb..5279baa 100644 --- a/ui/sort.go +++ b/ui/sort.go @@ -3,10 +3,71 @@ package ui import ( "cmp" "slices" + "time" ) -func sortMarkdowns(mds []*markdown) { +type SortType int +type SortOrder int + +const ( + SortByNote SortType = iota + SortByDate + SortByTitle +) + +const ( + SortAscending SortOrder = iota + SortDescending +) + +type SortState struct { + Type SortType + Order SortOrder +} + +func (s *SortState) Toggle(newType SortType) { + if s.Type == newType { + // Toggle order if same type + if s.Order == SortAscending { + s.Order = SortDescending + } else { + s.Order = SortAscending + } + } else { + // Set new type with default ascending order + s.Type = newType + s.Order = SortAscending + } +} + +func sortMarkdowns(mds []*markdown, state SortState) { slices.SortStableFunc(mds, func(a, b *markdown) int { - return cmp.Compare(a.Note, b.Note) + var comparison int + + switch state.Type { + case SortByDate: + comparison = compareTime(a.Modtime, b.Modtime) + case SortByTitle: + comparison = cmp.Compare(a.Note, b.Note) + default: // SortByNote + comparison = cmp.Compare(a.Note, b.Note) + } + + if state.Order == SortDescending { + comparison = -comparison + } + + return comparison }) } + +func compareTime(a, b time.Time) int { + switch { + case a.Before(b): + return -1 + case a.After(b): + return 1 + default: + return 0 + } +} diff --git a/ui/stash.go b/ui/stash.go index 85b76b5..d78d362 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -147,6 +147,7 @@ type stashModel struct { showStatusMessage bool statusMessage statusMessage statusMessageTimer *time.Timer + sortState SortState // Add sort state // Available document sections we can cycle through. We use a slice, rather // than a map, because order is important. @@ -220,7 +221,7 @@ func (m *stashModel) resetFiltering() { m.filterInput.Reset() m.filteredMarkdowns = nil - sortMarkdowns(m.markdowns) + sortMarkdowns(m.markdowns, m.sortState) // If the filtered section is present (it's always at the end) slice it out // of the sections slice to remove it from the UI. @@ -293,15 +294,9 @@ func (m stashModel) selectedMarkdown() *markdown { // Adds markdown documents to the model. func (m *stashModel) addMarkdowns(mds ...*markdown) { - if len(mds) == 0 { - return - } - m.markdowns = append(m.markdowns, mds...) - if !m.filterApplied() { - sortMarkdowns(m.markdowns) - } - + m.filteredMarkdowns = m.markdowns + sortMarkdowns(m.filteredMarkdowns, m.sortState) m.updatePagination() } @@ -394,6 +389,7 @@ func newStashModel(common *commonModel) stashModel { filterInput: si, serverPage: 1, sections: s, + sortState: SortState{Type: SortByNote, Order: SortAscending}, // Initialize sort state } return m @@ -562,6 +558,40 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { m.viewState = stashStateShowingError return nil } + + case "d": + m.sortState.Toggle(SortByDate) + sortMarkdowns(m.filteredMarkdowns, m.sortState) + m.statusMessage = statusMessage{ + status: normalStatusMessage, + message: fmt.Sprintf("Sorted by date %s", + map[SortOrder]string{ + SortAscending: "(oldest first)", + SortDescending: "(newest first)", + }[m.sortState.Order], + ), + } + m.showStatusMessage = true + cmds = append(cmds, func() tea.Msg { + return statusMessageTimeoutMsg(stashContext) + }) + + case "t": + m.sortState.Toggle(SortByTitle) + sortMarkdowns(m.filteredMarkdowns, m.sortState) + m.statusMessage = statusMessage{ + status: normalStatusMessage, + message: fmt.Sprintf("Sorted by title %s", + map[SortOrder]string{ + SortAscending: "(A to Z)", + SortDescending: "(Z to A)", + }[m.sortState.Order], + ), + } + m.showStatusMessage = true + cmds = append(cmds, func() tea.Msg { + return statusMessageTimeoutMsg(stashContext) + }) } } @@ -577,7 +607,7 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { switch key.String() { case "b", "u": m.paginator().PrevPage() - case "f", "d": + case "f": m.paginator().NextPage() } } @@ -861,8 +891,10 @@ func loadLocalMarkdown(md *markdown) tea.Cmd { func filterMarkdowns(m stashModel) tea.Cmd { return func() tea.Msg { - if m.filterInput.Value() == "" || !m.filterApplied() { - return filteredMarkdownMsg(m.markdowns) // return everything + if m.filterInput.Value() == "" { + m.filteredMarkdowns = m.markdowns + sortMarkdowns(m.filteredMarkdowns, m.sortState) + return filteredMarkdownMsg(m.filteredMarkdowns) } targets := []string{} diff --git a/ui/stashhelp.go b/ui/stashhelp.go index 01a0458..63058d9 100644 --- a/ui/stashhelp.go +++ b/ui/stashhelp.go @@ -106,12 +106,20 @@ func (m stashModel) helpView() (string, int) { editHelp []string sectionHelp []string appHelp []string + sortHelp []string ) if numDocs > 0 && m.showFullHelp { navHelp = []string{"enter", "open", "j/k ↑/↓", "choose"} } + if numDocs > 0 { + sortHelp = []string{ + "d", "toggle date sort", + "t", "toggle title sort", + } + } + if len(m.sections) > 1 { if m.showFullHelp { navHelp = append(navHelp, "tab/shift+tab", "section") @@ -145,14 +153,14 @@ func (m stashModel) helpView() (string, int) { if m.filterState != filtering { appHelp = append(appHelp, "?", "close help") } - return m.renderHelp(navHelp, filterHelp, append(selectionHelp, editHelp...), sectionHelp, appHelp) + return m.renderHelp(navHelp, sortHelp, filterHelp, append(selectionHelp, editHelp...), sectionHelp, appHelp) } // Mini help if m.filterState != filtering { appHelp = append(appHelp, "?", "more") } - return m.renderHelp(navHelp, filterHelp, selectionHelp, editHelp, sectionHelp, appHelp) + return m.renderHelp(navHelp, sortHelp, filterHelp, selectionHelp, editHelp, sectionHelp, appHelp) } const minHelpViewHeight = 5 From 34acc4c0718dbf8a9aba96cecabe12c078a9dfde Mon Sep 17 00:00:00 2001 From: Cam Michie Date: Tue, 13 May 2025 13:02:38 +0100 Subject: [PATCH 2/8] Make sort y, and not d, and restore d to being a pager --- ui/stash.go | 4 ++-- ui/stashhelp.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/stash.go b/ui/stash.go index d78d362..defa792 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -559,7 +559,7 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { return nil } - case "d": + case "y": m.sortState.Toggle(SortByDate) sortMarkdowns(m.filteredMarkdowns, m.sortState) m.statusMessage = statusMessage{ @@ -607,7 +607,7 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { switch key.String() { case "b", "u": m.paginator().PrevPage() - case "f": + case "d", "f": m.paginator().NextPage() } } diff --git a/ui/stashhelp.go b/ui/stashhelp.go index 63058d9..7ffe9a9 100644 --- a/ui/stashhelp.go +++ b/ui/stashhelp.go @@ -115,7 +115,7 @@ func (m stashModel) helpView() (string, int) { if numDocs > 0 { sortHelp = []string{ - "d", "toggle date sort", + "y", "toggle date sort", "t", "toggle title sort", } } From 9d02c0fbca92385f0fbd9222dc1fb2613fbce462 Mon Sep 17 00:00:00 2001 From: Cam Michie Date: Tue, 13 May 2025 13:03:49 +0100 Subject: [PATCH 3/8] Hide the previews for date sort and toggle sort behind the full help menu --- ui/stashhelp.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/stashhelp.go b/ui/stashhelp.go index 7ffe9a9..04d2c09 100644 --- a/ui/stashhelp.go +++ b/ui/stashhelp.go @@ -113,7 +113,8 @@ func (m stashModel) helpView() (string, int) { navHelp = []string{"enter", "open", "j/k ↑/↓", "choose"} } - if numDocs > 0 { + // Only show sort help in full help view + if numDocs > 0 && m.showFullHelp { sortHelp = []string{ "y", "toggle date sort", "t", "toggle title sort", @@ -160,7 +161,7 @@ func (m stashModel) helpView() (string, int) { if m.filterState != filtering { appHelp = append(appHelp, "?", "more") } - return m.renderHelp(navHelp, sortHelp, filterHelp, selectionHelp, editHelp, sectionHelp, appHelp) + return m.renderHelp(navHelp, filterHelp, selectionHelp, editHelp, sectionHelp, appHelp) } const minHelpViewHeight = 5 From 0e2363bff7a41499113b2171c862b83dfa8d754e Mon Sep 17 00:00:00 2001 From: Cam Michie Date: Tue, 13 May 2025 13:13:13 +0100 Subject: [PATCH 4/8] simplify sort.go to remove class --- ui/sort.go | 66 +++++++++++++++++------------------------------------ ui/stash.go | 38 ++++++++++++++++-------------- 2 files changed, 42 insertions(+), 62 deletions(-) diff --git a/ui/sort.go b/ui/sort.go index 5279baa..ee76bc3 100644 --- a/ui/sort.go +++ b/ui/sort.go @@ -6,61 +6,37 @@ import ( "time" ) -type SortType int -type SortOrder int +type sortOrder bool const ( - SortByNote SortType = iota - SortByDate - SortByTitle + ascending sortOrder = true + descending sortOrder = false ) -const ( - SortAscending SortOrder = iota - SortDescending -) - -type SortState struct { - Type SortType - Order SortOrder -} - -func (s *SortState) Toggle(newType SortType) { - if s.Type == newType { - // Toggle order if same type - if s.Order == SortAscending { - s.Order = SortDescending +func sortMarkdowns(mds []*markdown, byDate bool, ascending sortOrder) { + if byDate { + if ascending { + slices.SortStableFunc(mds, func(a, b *markdown) int { + return compareTime(a.Modtime, b.Modtime) + }) } else { - s.Order = SortAscending + slices.SortStableFunc(mds, func(a, b *markdown) int { + return -compareTime(a.Modtime, b.Modtime) + }) } } else { - // Set new type with default ascending order - s.Type = newType - s.Order = SortAscending + if ascending { + slices.SortStableFunc(mds, func(a, b *markdown) int { + return cmp.Compare(a.Note, b.Note) + }) + } else { + slices.SortStableFunc(mds, func(a, b *markdown) int { + return -cmp.Compare(a.Note, b.Note) + }) + } } } -func sortMarkdowns(mds []*markdown, state SortState) { - slices.SortStableFunc(mds, func(a, b *markdown) int { - var comparison int - - switch state.Type { - case SortByDate: - comparison = compareTime(a.Modtime, b.Modtime) - case SortByTitle: - comparison = cmp.Compare(a.Note, b.Note) - default: // SortByNote - comparison = cmp.Compare(a.Note, b.Note) - } - - if state.Order == SortDescending { - comparison = -comparison - } - - return comparison - }) -} - func compareTime(a, b time.Time) int { switch { case a.Before(b): diff --git a/ui/stash.go b/ui/stash.go index defa792..32052f8 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -147,7 +147,8 @@ type stashModel struct { showStatusMessage bool statusMessage statusMessage statusMessageTimer *time.Timer - sortState SortState // Add sort state + byDate bool // whether sorting by date + ascending bool // whether sorting ascending // Available document sections we can cycle through. We use a slice, rather // than a map, because order is important. @@ -221,7 +222,7 @@ func (m *stashModel) resetFiltering() { m.filterInput.Reset() m.filteredMarkdowns = nil - sortMarkdowns(m.markdowns, m.sortState) + sortMarkdowns(m.markdowns, m.byDate, sortOrder(m.ascending)) // If the filtered section is present (it's always at the end) slice it out // of the sections slice to remove it from the UI. @@ -296,7 +297,7 @@ func (m stashModel) selectedMarkdown() *markdown { func (m *stashModel) addMarkdowns(mds ...*markdown) { m.markdowns = append(m.markdowns, mds...) m.filteredMarkdowns = m.markdowns - sortMarkdowns(m.filteredMarkdowns, m.sortState) + sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.ascending)) m.updatePagination() } @@ -389,7 +390,8 @@ func newStashModel(common *commonModel) stashModel { filterInput: si, serverPage: 1, sections: s, - sortState: SortState{Type: SortByNote, Order: SortAscending}, // Initialize sort state + ascending: true, // Initialize with ascending sort + byDate: false, // Initialize with title sort } return m @@ -560,15 +562,16 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { } case "y": - m.sortState.Toggle(SortByDate) - sortMarkdowns(m.filteredMarkdowns, m.sortState) + m.byDate = true + m.ascending = !m.ascending + sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.ascending)) m.statusMessage = statusMessage{ status: normalStatusMessage, message: fmt.Sprintf("Sorted by date %s", - map[SortOrder]string{ - SortAscending: "(oldest first)", - SortDescending: "(newest first)", - }[m.sortState.Order], + map[bool]string{ + true: "(oldest first)", + false: "(newest first)", + }[m.ascending], ), } m.showStatusMessage = true @@ -577,15 +580,16 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { }) case "t": - m.sortState.Toggle(SortByTitle) - sortMarkdowns(m.filteredMarkdowns, m.sortState) + m.byDate = false + m.ascending = !m.ascending + sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.ascending)) m.statusMessage = statusMessage{ status: normalStatusMessage, message: fmt.Sprintf("Sorted by title %s", - map[SortOrder]string{ - SortAscending: "(A to Z)", - SortDescending: "(Z to A)", - }[m.sortState.Order], + map[bool]string{ + true: "(A to Z)", + false: "(Z to A)", + }[m.ascending], ), } m.showStatusMessage = true @@ -893,7 +897,7 @@ func filterMarkdowns(m stashModel) tea.Cmd { return func() tea.Msg { if m.filterInput.Value() == "" { m.filteredMarkdowns = m.markdowns - sortMarkdowns(m.filteredMarkdowns, m.sortState) + sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.ascending)) return filteredMarkdownMsg(m.filteredMarkdowns) } From 55b3578100a736b26449c60b33364efa8be0b085 Mon Sep 17 00:00:00 2001 From: Cam Michie Date: Tue, 13 May 2025 13:17:14 +0100 Subject: [PATCH 5/8] rename ascending to sortAscending in stash.go --- ui/stash.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ui/stash.go b/ui/stash.go index 32052f8..639803c 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -147,8 +147,8 @@ type stashModel struct { showStatusMessage bool statusMessage statusMessage statusMessageTimer *time.Timer - byDate bool // whether sorting by date - ascending bool // whether sorting ascending + byDate bool + sortAscending bool // Available document sections we can cycle through. We use a slice, rather // than a map, because order is important. @@ -222,7 +222,7 @@ func (m *stashModel) resetFiltering() { m.filterInput.Reset() m.filteredMarkdowns = nil - sortMarkdowns(m.markdowns, m.byDate, sortOrder(m.ascending)) + sortMarkdowns(m.markdowns, m.byDate, sortOrder(m.sortAscending)) // If the filtered section is present (it's always at the end) slice it out // of the sections slice to remove it from the UI. @@ -297,7 +297,7 @@ func (m stashModel) selectedMarkdown() *markdown { func (m *stashModel) addMarkdowns(mds ...*markdown) { m.markdowns = append(m.markdowns, mds...) m.filteredMarkdowns = m.markdowns - sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.ascending)) + sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.sortAscending)) m.updatePagination() } @@ -385,13 +385,13 @@ func newStashModel(common *commonModel) stashModel { } m := stashModel{ - common: common, - spinner: sp, - filterInput: si, - serverPage: 1, - sections: s, - ascending: true, // Initialize with ascending sort - byDate: false, // Initialize with title sort + common: common, + spinner: sp, + filterInput: si, + serverPage: 1, + sections: s, + sortAscending: true, // Initialize with sortAscending sort + byDate: false, // Initialize with title sort } return m @@ -563,15 +563,15 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { case "y": m.byDate = true - m.ascending = !m.ascending - sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.ascending)) + m.sortAscending = !m.sortAscending + sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.sortAscending)) m.statusMessage = statusMessage{ status: normalStatusMessage, message: fmt.Sprintf("Sorted by date %s", map[bool]string{ true: "(oldest first)", false: "(newest first)", - }[m.ascending], + }[m.sortAscending], ), } m.showStatusMessage = true @@ -581,15 +581,15 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { case "t": m.byDate = false - m.ascending = !m.ascending - sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.ascending)) + m.sortAscending = !m.sortAscending + sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.sortAscending)) m.statusMessage = statusMessage{ status: normalStatusMessage, message: fmt.Sprintf("Sorted by title %s", map[bool]string{ true: "(A to Z)", false: "(Z to A)", - }[m.ascending], + }[m.sortAscending], ), } m.showStatusMessage = true @@ -897,7 +897,7 @@ func filterMarkdowns(m stashModel) tea.Cmd { return func() tea.Msg { if m.filterInput.Value() == "" { m.filteredMarkdowns = m.markdowns - sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.ascending)) + sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.sortAscending)) return filteredMarkdownMsg(m.filteredMarkdowns) } From 3b3a3a0abddbaacce67536308b14027888d19696 Mon Sep 17 00:00:00 2001 From: Cam Michie Date: Tue, 13 May 2025 13:18:15 +0100 Subject: [PATCH 6/8] rename byDate to sortByDate in stash.go --- ui/stash.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ui/stash.go b/ui/stash.go index 639803c..d975b27 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -147,7 +147,7 @@ type stashModel struct { showStatusMessage bool statusMessage statusMessage statusMessageTimer *time.Timer - byDate bool + sortByDate bool sortAscending bool // Available document sections we can cycle through. We use a slice, rather @@ -222,7 +222,7 @@ func (m *stashModel) resetFiltering() { m.filterInput.Reset() m.filteredMarkdowns = nil - sortMarkdowns(m.markdowns, m.byDate, sortOrder(m.sortAscending)) + sortMarkdowns(m.markdowns, m.sortByDate, sortOrder(m.sortAscending)) // If the filtered section is present (it's always at the end) slice it out // of the sections slice to remove it from the UI. @@ -297,7 +297,7 @@ func (m stashModel) selectedMarkdown() *markdown { func (m *stashModel) addMarkdowns(mds ...*markdown) { m.markdowns = append(m.markdowns, mds...) m.filteredMarkdowns = m.markdowns - sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.sortAscending)) + sortMarkdowns(m.filteredMarkdowns, m.sortByDate, sortOrder(m.sortAscending)) m.updatePagination() } @@ -391,7 +391,7 @@ func newStashModel(common *commonModel) stashModel { serverPage: 1, sections: s, sortAscending: true, // Initialize with sortAscending sort - byDate: false, // Initialize with title sort + sortByDate: false, // Initialize with title sort } return m @@ -562,9 +562,9 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { } case "y": - m.byDate = true + m.sortByDate = true m.sortAscending = !m.sortAscending - sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.sortAscending)) + sortMarkdowns(m.filteredMarkdowns, m.sortByDate, sortOrder(m.sortAscending)) m.statusMessage = statusMessage{ status: normalStatusMessage, message: fmt.Sprintf("Sorted by date %s", @@ -580,9 +580,9 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd { }) case "t": - m.byDate = false + m.sortByDate = false m.sortAscending = !m.sortAscending - sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.sortAscending)) + sortMarkdowns(m.filteredMarkdowns, m.sortByDate, sortOrder(m.sortAscending)) m.statusMessage = statusMessage{ status: normalStatusMessage, message: fmt.Sprintf("Sorted by title %s", @@ -897,7 +897,7 @@ func filterMarkdowns(m stashModel) tea.Cmd { return func() tea.Msg { if m.filterInput.Value() == "" { m.filteredMarkdowns = m.markdowns - sortMarkdowns(m.filteredMarkdowns, m.byDate, sortOrder(m.sortAscending)) + sortMarkdowns(m.filteredMarkdowns, m.sortByDate, sortOrder(m.sortAscending)) return filteredMarkdownMsg(m.filteredMarkdowns) } From 5dc3ee1cc4a3929a5b33e6b925d63b3365e4be0a Mon Sep 17 00:00:00 2001 From: Cam Michie Date: Tue, 13 May 2025 13:20:14 +0100 Subject: [PATCH 7/8] rename byDate to sortByDate in sort.go --- ui/sort.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/sort.go b/ui/sort.go index ee76bc3..508e142 100644 --- a/ui/sort.go +++ b/ui/sort.go @@ -13,8 +13,8 @@ const ( descending sortOrder = false ) -func sortMarkdowns(mds []*markdown, byDate bool, ascending sortOrder) { - if byDate { +func sortMarkdowns(mds []*markdown, sortByDate bool, ascending sortOrder) { + if sortByDate { if ascending { slices.SortStableFunc(mds, func(a, b *markdown) int { return compareTime(a.Modtime, b.Modtime) From ba91a80e6f6a5d25fd3a283d9f65bf276b81cd49 Mon Sep 17 00:00:00 2001 From: Cam Michie Date: Tue, 13 May 2025 13:21:59 +0100 Subject: [PATCH 8/8] remove unnecessary comment --- ui/stash.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/stash.go b/ui/stash.go index d975b27..91fefad 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -390,8 +390,8 @@ func newStashModel(common *commonModel) stashModel { filterInput: si, serverPage: 1, sections: s, - sortAscending: true, // Initialize with sortAscending sort - sortByDate: false, // Initialize with title sort + sortAscending: true, + sortByDate: false, } return m