mirror of
https://github.com/charmbracelet/gum
synced 2024-06-17 13:05:05 +02:00
fix "shuffling"
This commit is contained in:
parent
d74f126d41
commit
d45b728b4d
|
@ -11,6 +11,7 @@
|
||||||
package filter
|
package filter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/charmbracelet/bubbles/textinput"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
|
@ -274,6 +275,13 @@ func exactMatches(search string, matches []fuzzy.Match) []fuzzy.Match {
|
||||||
exactMatches = append(exactMatches, m)
|
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
|
return exactMatches
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue