diff --git a/ui/stash.go b/ui/stash.go index 218b6b2..c1311b6 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -505,6 +505,10 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { case "m": m.hideStatusMessage() + if pages == 0 { + break + } + md := m.selectedMarkdown() isUserMarkdown := md.markdownType == stashedMarkdown || md.markdownType == convertedMarkdown isSettingNote := m.state == stashStateSettingNote @@ -523,6 +527,10 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { break } + if pages == 0 { + break + } + md := m.selectedMarkdown() // is the file in the process of being stashed? @@ -553,6 +561,10 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { case "x": m.hideStatusMessage() + if pages == 0 { + break + } + t := m.selectedMarkdown().markdownType isUserMarkdown := t == stashedMarkdown || t == convertedMarkdown isValidState := m.state != stashStateSettingNote @@ -933,7 +945,7 @@ func stashHelpView(m stashModel) string { isLocal bool ) - if len(m.markdowns) > 0 { + if len(m.getNotes()) > 0 { md := m.selectedMarkdown() isStashed = md != nil && md.markdownType == stashedMarkdown isLocal = md != nil && md.markdownType == localMarkdown