mirror of
https://github.com/solaeus/nucleo.git
synced 2024-12-22 01:47:49 +00:00
fix sort order of literal matcher (#13)
This commit is contained in:
parent
685e699bc5
commit
f18c19cd53
@ -2,7 +2,7 @@
|
|||||||
name = "nucleo"
|
name = "nucleo"
|
||||||
description = "plug and play high performance fuzzy matcher"
|
description = "plug and play high performance fuzzy matcher"
|
||||||
authors = ["Pascal Kuthe <pascal.kuthe@semimod.de>"]
|
authors = ["Pascal Kuthe <pascal.kuthe@semimod.de>"]
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/helix-editor/nucleo"
|
repository = "https://github.com/helix-editor/nucleo"
|
||||||
|
@ -345,6 +345,6 @@ pub fn fuzzy_match<T: AsRef<str>>(
|
|||||||
.map(|score| (item, score))
|
.map(|score| (item, score))
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
items.sort_by_key(|(item, score)| (Reverse(*score), item.as_ref().len()));
|
items.sort_by_key(|(_, score)| Reverse(*score));
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,9 @@ impl Pattern {
|
|||||||
self.atoms.clear();
|
self.atoms.clear();
|
||||||
let pattern =
|
let pattern =
|
||||||
PatternAtom::literal(pattern, self.normalize, self.case_matching, kind, false);
|
PatternAtom::literal(pattern, self.normalize, self.case_matching, kind, false);
|
||||||
self.atoms.push(pattern);
|
if !pattern.needle.is_empty() {
|
||||||
|
self.atoms.push(pattern);
|
||||||
|
}
|
||||||
self.status = if append && self.status != Status::Rescore {
|
self.status = if append && self.status != Status::Rescore {
|
||||||
Status::Update
|
Status::Update
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user