Unnamed repository; edit this file 'description' to name the repository.
Bump nucleo to v0.4.1
We will use this in the child commit to improve the picker's running indicator. Nucleo 0.4.0 includes an `active_injectors` member that we can use to detect if anything can push to the picker. When that count drops to zero we can remove the running indicator. Nucleo 0.4.1 contains a fix for crashes with interactive global search on a large directory.
Michael Davis 2024-07-15
parent 2c9f5b3 · commit 11f809c
-rw-r--r--Cargo.lock15
-rw-r--r--Cargo.toml2
-rw-r--r--helix-core/src/fuzzy.rs10
-rw-r--r--helix-term/src/ui/menu.rs10
-rw-r--r--helix-term/src/ui/picker.rs12
5 files changed, 29 insertions, 20 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 57bdb235..d8e65a8f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -210,12 +210,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
-name = "cov-mark"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ffa3d3e0138386cd4361f63537765cac7ee40698028844635a54495a92f67f3"
-
-[[package]]
name = "crc32fast"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1785,9 +1779,9 @@ dependencies = [
[[package]]
name = "nucleo"
-version = "0.2.1"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae5331f4bcce475cf28cb29c95366c3091af4b0aa7703f1a6bc858f29718fdf3"
+checksum = "6350a138d8860658523a7593cbf6813999d17a099371d14f70c5c905b37593e9"
dependencies = [
"nucleo-matcher",
"parking_lot",
@@ -1796,11 +1790,10 @@ dependencies = [
[[package]]
name = "nucleo-matcher"
-version = "0.2.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b702b402fe286162d1f00b552a046ce74365d2ac473a2607ff36ba650f9bd57"
+checksum = "bf33f538733d1a5a3494b836ba913207f14d9d4a1d3cd67030c5061bdd2cac85"
dependencies = [
- "cov-mark",
"memchr",
"unicode-segmentation",
]
diff --git a/Cargo.toml b/Cargo.toml
index 9be265fc..d9541b64 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -38,7 +38,7 @@ package.helix-term.opt-level = 2
[workspace.dependencies]
tree-sitter = { version = "0.22" }
-nucleo = "0.2.0"
+nucleo = "0.4.1"
slotmap = "1.0.7"
thiserror = "1.0"
diff --git a/helix-core/src/fuzzy.rs b/helix-core/src/fuzzy.rs
index 549c6b0e..da46518f 100644
--- a/helix-core/src/fuzzy.rs
+++ b/helix-core/src/fuzzy.rs
@@ -1,6 +1,6 @@
use std::ops::DerefMut;
-use nucleo::pattern::{Atom, AtomKind, CaseMatching};
+use nucleo::pattern::{Atom, AtomKind, CaseMatching, Normalization};
use nucleo::Config;
use parking_lot::Mutex;
@@ -38,6 +38,12 @@ pub fn fuzzy_match<T: AsRef<str>>(
if path {
matcher.config.set_match_paths();
}
- let pattern = Atom::new(pattern, CaseMatching::Smart, AtomKind::Fuzzy, false);
+ let pattern = Atom::new(
+ pattern,
+ CaseMatching::Smart,
+ Normalization::Smart,
+ AtomKind::Fuzzy,
+ false,
+ );
pattern.match_list(items, &mut matcher)
}
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index 1520924c..c120d0b2 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -5,7 +5,7 @@ use crate::{
ctrl, key, shift,
};
use helix_core::fuzzy::MATCHER;
-use nucleo::pattern::{Atom, AtomKind, CaseMatching};
+use nucleo::pattern::{Atom, AtomKind, CaseMatching, Normalization};
use nucleo::{Config, Utf32Str};
use tui::{buffer::Buffer as Surface, widgets::Table};
@@ -80,7 +80,13 @@ impl<T: Item> Menu<T> {
pub fn score(&mut self, pattern: &str, incremental: bool) {
let mut matcher = MATCHER.lock();
matcher.config = Config::DEFAULT;
- let pattern = Atom::new(pattern, CaseMatching::Ignore, AtomKind::Fuzzy, false);
+ let pattern = Atom::new(
+ pattern,
+ CaseMatching::Ignore,
+ Normalization::Smart,
+ AtomKind::Fuzzy,
+ false,
+ );
let mut buf = Vec::new();
if incremental {
self.matches.retain_mut(|(index, score)| {
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 7e053c4a..fc1eba6e 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -16,7 +16,7 @@ use crate::{
};
use futures_util::future::BoxFuture;
use helix_event::AsyncHook;
-use nucleo::pattern::CaseMatching;
+use nucleo::pattern::{CaseMatching, Normalization};
use nucleo::{Config, Nucleo, Utf32String};
use thiserror::Error;
use tokio::sync::mpsc::Sender;
@@ -506,9 +506,13 @@ impl<T: 'static + Send + Sync, D: 'static + Send + Sync> Picker<T, D> {
continue;
}
let is_append = pattern.starts_with(old_pattern);
- self.matcher
- .pattern
- .reparse(i, pattern, CaseMatching::Smart, is_append);
+ self.matcher.pattern.reparse(
+ i,
+ pattern,
+ CaseMatching::Smart,
+ Normalization::Smart,
+ is_append,
+ );
}
}