mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
d823444c6e
Before 1c4e5cadf2
(Autosuggestions in multi-line command lines,
2024-12-15), the completion code path in the autosuggestion performer
used to do something weird: it used to request completions for the
entire command line (with the implied cursor at end) but try to apply
the same completion at the actual cursor.
That commit changed this to request completions only up to the cursor
position, which could in theory make us produce valid completions even
if the cursor is not at end of the line. However, that doesn't really
work since autosuggestions can only be rendered at the end of the line.
And the worst of it, that commit tries to compute
line_at_cursor(&full_line, search_string_range.end)
which crashes as out-of-bounds if the completion needs to replace the token
(like a case-correcting completion does).
Let's apply completions to the end, matching how autosuggestions work
in general.
25 lines
674 B
Fish
25 lines
674 B
Fish
#RUN: %fish %s
|
|
#REQUIRES: command -v tmux
|
|
|
|
isolated-tmux-start
|
|
isolated-tmux send-keys 'echo "foo bar baz"' Enter C-l
|
|
isolated-tmux send-keys 'echo '
|
|
tmux-sleep
|
|
isolated-tmux send-keys M-Right
|
|
isolated-tmux capture-pane -p
|
|
# CHECK: prompt 1> echo "foo bar baz"
|
|
tmux-sleep
|
|
|
|
touch COMPL
|
|
|
|
# Regression test.
|
|
isolated-tmux send-keys C-u C-l ': sometoken' M-b c
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
# CHECK: prompt 1> : csometoken
|
|
|
|
# Test that we get completion autosuggestions also when the cursor is not at EOL.
|
|
isolated-tmux send-keys C-u 'complete nofilecomp -f' Enter C-l 'nofilecomp ./CO' C-a M-d :
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
# CHECK: prompt 2> : ./COMPL
|