mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-22 20:31:15 -03:00
Only use fuzzy option completion if there is a leading -
Commit b768b9d3f (Use fuzzy subsequence completion for options names as well,
2024-01-27) allowed completing "oa" to "--foobar", which is a false positive,
especially because it hides other valid completions of non-option arguments.
Let's at least require a leading dash again before completing option names.
This commit is contained in:
@@ -1435,6 +1435,9 @@ fn complete_param_for_command(
|
||||
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;
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user