From 63d7fe8b2ffdb1afebbe26d42b69bdb5710e7276 Mon Sep 17 00:00:00 2001 From: ysthakur <45539777+ysthakur@users.noreply.github.com> Date: Mon, 26 Aug 2024 17:54:31 -0400 Subject: [PATCH] Take positional into account --- crates/nu-cli/src/completions/completion_options.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/nu-cli/src/completions/completion_options.rs b/crates/nu-cli/src/completions/completion_options.rs index 9ee4d067c0..cf90ac1032 100644 --- a/crates/nu-cli/src/completions/completion_options.rs +++ b/crates/nu-cli/src/completions/completion_options.rs @@ -77,12 +77,15 @@ impl NuMatcher { } else { Cow::Owned(haystack.to_folded_case()) }; - if haystack_lowercased.starts_with(self.needle.as_str()) { - items.push((haystack, item)); - true + let matches = if self.options.positional { + haystack_lowercased.starts_with(self.needle.as_str()) } else { - false + haystack_lowercased.contains(self.needle.as_str()) + }; + if matches { + items.push((haystack, item)); } + matches } State::Fuzzy { items } => { let mut matcher = SkimMatcherV2::default();