From 988093b50e45b517789ea1d439787d2907dded12 Mon Sep 17 00:00:00 2001 From: Nguyen Duc Toan Date: Sun, 14 Apr 2024 13:37:50 +0700 Subject: [PATCH] implement smart case completion --- yazi-core/src/completion/commands/show.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yazi-core/src/completion/commands/show.rs b/yazi-core/src/completion/commands/show.rs index b5b61c1f..d29f0edf 100644 --- a/yazi-core/src/completion/commands/show.rs +++ b/yazi-core/src/completion/commands/show.rs @@ -29,7 +29,12 @@ impl Completion { let flow = cache.iter().try_fold( (Vec::with_capacity(LIMIT), Vec::with_capacity(LIMIT)), |(mut prefixed, mut fuzzy), s| { - if s.starts_with(word) { + let start_with_word = if word.chars().any(|c| c.is_uppercase()) { + s.starts_with(word) + } else { + s.to_lowercase().starts_with(word) + }; + if start_with_word { if s != word { prefixed.push(s); if prefixed.len() >= LIMIT {