fix "shuffling"

This commit is contained in:
Enrico Candino 2022-10-09 00:33:15 +02:00 committed by Maas Lalani
parent d74f126d41
commit d45b728b4d

View file

@ -11,6 +11,7 @@
package filter
import (
"sort"
"strings"
"github.com/charmbracelet/bubbles/textinput"
@ -274,6 +275,13 @@ func exactMatches(search string, matches []fuzzy.Match) []fuzzy.Match {
exactMatches = append(exactMatches, m)
}
}
// we need to sort by name the matches because
// they are sorted with the fuzzy ranking
sort.Slice(exactMatches, func(i, j int) bool {
return exactMatches[i].Str > exactMatches[j].Str
})
return exactMatches
}