mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00: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:
parent
6f0894c652
commit
54bc196918
2 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue