Change help text if we've filtered down to one item

This commit is contained in:
Christian Rocha 2020-11-10 18:09:34 -05:00 committed by Christian Rocha
parent 75528db9f1
commit 9797f225a7

View file

@ -938,9 +938,10 @@ func stashHelpView(m stashModel) string {
h []string h []string
isStashed bool isStashed bool
isLocal bool isLocal bool
numDocs = len(m.getNotes())
) )
if len(m.getNotes()) > 0 { if numDocs > 0 {
md := m.selectedMarkdown() md := m.selectedMarkdown()
isStashed = md != nil && md.markdownType == stashedMarkdown isStashed = md != nil && md.markdownType == stashedMarkdown
isLocal = md != nil && md.markdownType == localMarkdown isLocal = md != nil && md.markdownType == localMarkdown
@ -950,6 +951,8 @@ func stashHelpView(m stashModel) string {
h = append(h, "enter: confirm", "esc: cancel") h = append(h, "enter: confirm", "esc: cancel")
} else if m.state == stashStatePromptDelete { } else if m.state == stashStatePromptDelete {
h = append(h, "y: delete", "n: cancel") h = append(h, "y: delete", "n: cancel")
} else if m.state == stashStateSearchNotes && numDocs == 1 {
h = append(h, "enter: open", "esc: cancel")
} else if m.state == stashStateSearchNotes { } else if m.state == stashStateSearchNotes {
h = append(h, "enter: confirm", "esc: cancel", "ctrl+j/ctrl+k, ↑/↓: choose") h = append(h, "enter: confirm", "esc: cancel", "ctrl+j/ctrl+k, ↑/↓: choose")
} else { } else {