-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the correct case in completion pager
Consider $ complete -c foo -a 'aab aaB' -f $ foo A<TAB> since 28d67c8 we would insert the common prefix AND show the pager. Due to case-insensitive comparison, "b/B" was considered to be part of the prefix. Since the prefix is added to each pager item [1] we get wrong results. Fix this by removing the insensitive comparison between completions - I don't think it was of much use anyway. Commandline tokens are still matched case-insensitively, this is just about completions. Test this by running interactive fish inside tmux (pexpect's terminal emulation not have enough capabilities). Also add tests for recent interactive regressions #7526 and #7738. Closes #3978 [1]: b38a23a would solve this differently by giving every pager item its own prefix, but was reverted since it needs more fixes.
- Loading branch information
Showing
3 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#RUN: %fish -C 'set -g fish %fish' %s | ||
#REQUIRES: command -v tmux | ||
|
||
# Isolated tmux. | ||
set -g tmpdir (mktemp -d) | ||
set -g tmux tmux -S $tmpdir/.tmux-socket -f /dev/null | ||
|
||
set -g sleep sleep .3 # TSan tests in the CI failed with .1. | ||
|
||
set fish (realpath $fish) | ||
cd $tmpdir | ||
|
||
$tmux new-session -d $fish -C ' | ||
# This is similar to "tests/interactive.config". | ||
function fish_greeting; end | ||
function fish_prompt; printf "prompt $status_generation> "; end | ||
# No autosuggestion from older history. | ||
set fish_history "" | ||
' | ||
$tmux resize-window -x 80 -y 10 | ||
$sleep # Let fish draw a prompt. | ||
|
||
# Don't escape existing token (#7526). | ||
echo >file-1 | ||
echo >file-2 | ||
$tmux send-keys 'HOME=$PWD ls ~/' Tab | ||
$sleep | ||
$tmux capture-pane -p | ||
# CHECK: prompt 0> HOME=$PWD ls ~/file- | ||
# CHECK: ~/file-1 ~/file-2 | ||
|
||
# No pager on single smartcase completion (#7738). | ||
$tmux send-keys C-u C-l 'mkdir cmake CMakeFiles' Enter C-l \ | ||
'cat cmake' Tab | ||
$sleep | ||
$tmux capture-pane -p | ||
# CHECK: prompt 1> cat cmake/ | ||
|
||
# Correct case in pager when prefies differ in case (#7743). | ||
$tmux send-keys C-u C-l 'complete -c foo2 -a "aabc aaBd" -f' Enter C-l \ | ||
'foo2 A' Tab | ||
$sleep | ||
$tmux capture-pane -p | ||
# The "bc" part is the autosuggestion - we could use "tmux capture-pane -e" to check colors. | ||
# CHECK: prompt 2> foo2 aabc | ||
# CHECK: aabc aaBd | ||
|
||
$tmux kill-server | ||
rm -r $tmpdir |