Fix shift+tab on first item in fuzzy search dialog. Fixes #182

This commit is contained in:
Tulir Asokan 2020-06-24 22:47:42 +03:00
parent 5c4458384a
commit 48537f98ce

View File

@ -135,6 +135,9 @@ func (fs *FuzzySearchModal) OnKeyEvent(event mauview.KeyEvent) bool {
case tcell.KeyBacktab: case tcell.KeyBacktab:
if len(highlights) > 0 { if len(highlights) > 0 {
fs.selected = (fs.selected - 1) % len(fs.matches) fs.selected = (fs.selected - 1) % len(fs.matches)
if fs.selected < 0 {
fs.selected += len(fs.matches)
}
fs.results.Highlight(strconv.Itoa(fs.matches[fs.selected].OriginalIndex)) fs.results.Highlight(strconv.Itoa(fs.matches[fs.selected].OriginalIndex))
fs.results.ScrollToHighlight() fs.results.ScrollToHighlight()
} }