mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 10:01:14 -03:00
Fix option substr completions not being filtered out
Commit 3546ffa3ef (reader handle_completions(): remove dead filtering code,
2026-01-02) gives a proof of correctness that still makes sense;
The first lemma ("if will_replace_token") is trivially true, so no need to
assert it.
The second lemma ("if !will_replace_token") is violated in some edge cases:
we claim that given a token "-c", the option completion "--clip" is an exact match,
which is not true, it's a substring match.
Fix that, asserting the claim.
This commit is contained in:
30
tests/checks/tmux-complete4.fish
Normal file
30
tests/checks/tmux-complete4.fish
Normal file
@@ -0,0 +1,30 @@
|
||||
#RUN: %fish %s
|
||||
#REQUIRES: command -v tmux
|
||||
#REQUIRES: uname -r | grep -qv Microsoft
|
||||
|
||||
isolated-tmux-start -C '
|
||||
complete : -s c -l clip
|
||||
complete : -s q -l qrcode
|
||||
set -g fish_autosuggestion_enabled 0
|
||||
'
|
||||
touch somefile1
|
||||
touch somefile2
|
||||
|
||||
isolated-tmux send-keys C-l ': -c'
|
||||
|
||||
function tab
|
||||
isolated-tmux send-keys Tab
|
||||
tmux-sleep
|
||||
isolated-tmux capture-pane -p | sed '/./ { s,^,[,; s,$,], }'
|
||||
end
|
||||
|
||||
tab
|
||||
# CHECK: [prompt 0> : -cq]
|
||||
|
||||
tab
|
||||
# CHECK: [prompt 0> : -cq somefile]
|
||||
# CHECK: [somefile1 somefile2]
|
||||
|
||||
tab
|
||||
# CHECK: [prompt 0> : -cq somefile1]
|
||||
# CHECK: [somefile1 somefile2]
|
||||
Reference in New Issue
Block a user