fix: sort by length (shortest first) for equal fuzzy matching scores in palette
This commit is contained in:
parent
9d93ba5319
commit
9b80687373
1 changed files with 4 additions and 1 deletions
|
@ -353,7 +353,10 @@ pub fn Create(options: type) type {
|
|||
|
||||
const less_fn = struct {
|
||||
fn less_fn(_: void, lhs: Match, rhs: Match) bool {
|
||||
return lhs.score > rhs.score;
|
||||
return if (lhs.score == rhs.score)
|
||||
lhs.entry.name.len < rhs.entry.name.len
|
||||
else
|
||||
lhs.score > rhs.score;
|
||||
}
|
||||
}.less_fn;
|
||||
std.mem.sort(Match, matches.items, {}, less_fn);
|
||||
|
|
Loading…
Add table
Reference in a new issue