mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-16 06:54:03 +00:00
51adba6ee0
Backspace signals that the user is not happy with the commandline, and by extension the autosuggestion. For this reason, backspace suppresses autosuggestions until the next text insertion. However if I 1. type something that has an autosuggestion 2. type *one* wrong letter (removing the autosuggestion) 3. type backspace backspace does not visibly suppress any autosuggestion but rhater signal that the user wants to go back to the previous state of the commandline, which does have an autosuggestion. Enable this scenario by caching the autosuggestion when it's invalidated. On certain edits that make the cached autosuggestion valid again, restore it from the cache. Currently, only do this up to a single backspace. Could extend that in future. This implementation is really bad.. but it's a start. Weirdly, it does not restore the cache on undo; but that's inconsequential because undo doesn't suppress autosuggestion as of today. Closes #3549
32 lines
831 B
Fish
32 lines
831 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
|
|
|
|
isolated-tmux send-keys C-u C-k C-l ': ./CO'
|
|
tmux-sleep
|
|
isolated-tmux send-keys A C-h
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
# CHECK: prompt 2> : ./COMPL
|