diff --git a/Cargo.toml b/Cargo.toml index 4a9732a..43e6806 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "nucleo" description = "plug and play high performance fuzzy matcher" authors = ["Pascal Kuthe "] -version = "0.1.0" +version = "0.1.1" edition = "2021" license = "MPL-2.0" repository = "https://github.com/helix-editor/nucleo" diff --git a/src/lib.rs b/src/lib.rs index 9d2725d..59386bd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -345,6 +345,6 @@ pub fn fuzzy_match>( .map(|score| (item, score)) }) .collect(); - items.sort_by_key(|(item, score)| (Reverse(*score), item.as_ref().len())); + items.sort_by_key(|(_, score)| Reverse(*score)); items } diff --git a/src/pattern.rs b/src/pattern.rs index 9475a13..f9939c6 100644 --- a/src/pattern.rs +++ b/src/pattern.rs @@ -373,7 +373,9 @@ impl Pattern { self.atoms.clear(); let pattern = 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 { Status::Update } else {