reader handle_completions(): don't consider odd replacing completions for common prefix

If "will_replace_token" is set, we generally only consider
appending completions.  This changed in commit 656b39a0b3 (Also show
case-insensitive prefix matches in completion pager, 2025-11-23) which
also allowed icase completions as long as they are also prefix matches.

Such replacing completions might cause the common prefix to be empty,
which breaks the appending completions.

Fix this by not considering these replacing completions for the
common-prefix computation. The pager already doesn't show the prefix
for these completions specifically.

Fixes #12249
This commit is contained in:
Johannes Altmanninger
2026-01-02 07:17:54 +01:00
parent 3546ffa3ef
commit 2f6b1eaaf9
3 changed files with 19 additions and 0 deletions

View File

@@ -36,3 +36,18 @@ tmux-sleep
isolated-tmux capture-pane -p
# CHECK: prompt 1> echo $FISH_TEST_VAR_
# CHECK: $FISH_TEST_VAR_1 (Variable: /) $FISH_TEST_VAR_2 (Variable: /)
mkdir -p clang/include
touch clang/INSTALL.txt
isolated-tmux send-keys C-u ': clang/in' Tab
tmux-sleep
isolated-tmux capture-pane -p
# CHECK: prompt 1> : clang/include/
# CHECK: clang/INSTALL.txt …/
mkdir -p clang/include-2
isolated-tmux send-keys C-u ': clang/in' Tab
tmux-sleep
isolated-tmux capture-pane -p
# CHECK: prompt 1> : clang/include
# CHECK: clang/INSTALL.txt …/include/ …/include-2/