diff --git a/src/complete.rs b/src/complete.rs index 03ab564e9..0e1b09442 100644 --- a/src/complete.rs +++ b/src/complete.rs @@ -1435,6 +1435,9 @@ impl<'ctx> Completer<'ctx> { if whole_opt.len() < s.len() { continue; } + if !s.starts_with("-") { + continue; + } let anchor_start = !self.flags.fuzzy_match; let Some(r#match) = string_fuzzy_match_string(s, &whole_opt, anchor_start) else { continue; diff --git a/tests/checks/complete.fish b/tests/checks/complete.fish index 931c2cc22..1270d1713 100644 --- a/tests/checks/complete.fish +++ b/tests/checks/complete.fish @@ -601,3 +601,5 @@ complete -C'complete_long_option --slo' complete complete_long_option -f -o an-old-option complete -C'complete_long_option -ao' # CHECK: -an-old-option +# But only if the user typed a dash +complete -C'complete_long_option lo'