mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 13:08:49 +00:00
83b0294fc9
On ctrl-l we send `\e[2J` (Erase in Display). Some terminals interpret this to scroll the screen content instead of clearing it. This happens on VTE-based terminals like gnome-terminal for example. The traditional behavior of ctrl-l erasing the screen (but not the rest of the scrollback) is weird because: 1. `ctrl-l` is the easiest and most portable way to push the prompt to the top (and repaint after glitches I guess). But it's also a destructive action, truncating scrollback. I use it for scrolling and am frequently surprised when my scroll back is missing information. 2. the amount of lines erased depends on the window size. It would be more intuitive to erase by prompts, or erase the text in the terminal selection. Let's use scrolling behavior on all terminals. The new command could also be named "push-to-scrollback", for consistency with others. But if we anticipate a want to add other scrollback-related commands, "scrollback-push" is better. This causes tests/checks/tmux-history-search.fish to fail; that test seems pretty broken; M-d (alt-d) is supposed to delete the current search match but there is a rogue "echo" that is supposed to invalidate the search match. I'm not sure how that ever worked. Also, pexepect doesn't seem to support cursor position reporting, so work around that. Ref: https://codeberg.org/dnkl/foot/wiki#how-do-i-make-ctrl-l-scroll-the-content-instead-of-erasing-it as of wiki commit b57489e298f95d037fdf34da00ea60a5e8eafd6d Closes #10934
74 lines
2.2 KiB
Fish
74 lines
2.2 KiB
Fish
#RUN: %fish %s
|
|
#REQUIRES: command -v tmux
|
|
# disable on github actions because it's flakey
|
|
#REQUIRES: test -z "$CI"
|
|
|
|
# The default history-pager-delete binding is shift-delete which
|
|
# won't work on terminals that don't support CSI u, so rebind.
|
|
set -g isolated_tmux_fish_extra_args -C '
|
|
set -g fish_autosuggestion_enabled 0
|
|
bind alt-d history-pager-delete or backward-delete-char
|
|
'
|
|
isolated-tmux-start
|
|
|
|
isolated-tmux send-keys 'true needle' Enter
|
|
# CHECK: prompt 0> true needle
|
|
tmux-sleep
|
|
isolated-tmux send-keys 'true hay ee hay' Enter
|
|
# CHECK: prompt 1> true hay ee hay
|
|
tmux-sleep
|
|
isolated-tmux send-keys C-p C-a M-f M-f M-f M-.
|
|
# CHECK: prompt 2> true hay needle hay
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
|
|
isolated-tmux send-keys C-e C-u true Up Up Escape
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p | grep 'prompt 2'
|
|
# CHECK: prompt 2> true
|
|
isolated-tmux send-keys C-z _
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p | grep 'prompt 2'
|
|
# CHECK: prompt 2> _
|
|
|
|
# When history pager fails to find a result, copy the search field to the command line.
|
|
isolated-tmux send-keys C-e C-u C-r "echo no such command in history"
|
|
tmux-sleep
|
|
isolated-tmux send-keys Enter
|
|
# CHECK: prompt 2> echo no such command in history
|
|
isolated-tmux capture-pane -p | grep 'prompt 2'
|
|
isolated-tmux send-keys C-c
|
|
|
|
isolated-tmux send-keys C-r hay/shmay
|
|
isolated-tmux send-keys C-w C-h
|
|
isolated-tmux send-keys Enter
|
|
# CHECK: prompt 2> true hay ee hay
|
|
isolated-tmux capture-pane -p | grep 'prompt 2>'
|
|
isolated-tmux send-keys C-c
|
|
|
|
isolated-tmux send-keys 'echo 1' Enter 'echo 2' Enter 'echo 3' Enter
|
|
isolated-tmux send-keys C-l echo Up M-d
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p
|
|
#CHECK: prompt 5> echo 2
|
|
isolated-tmux send-keys C-c
|
|
tmux-sleep
|
|
|
|
isolated-tmux send-keys "echo sdifjsdoifjsdoifj" Enter
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p | grep "^sdifjsdoifjsdoifj\|prompt 6>"
|
|
# CHECK: sdifjsdoifjsdoifj
|
|
# CHECK: prompt 6>
|
|
isolated-tmux send-keys C-e C-u C-r
|
|
tmux-sleep
|
|
isolated-tmux send-keys "echo sdifjsdoifjsdoifj"
|
|
tmux-sleep
|
|
isolated-tmux send-keys M-d # alt-d
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p | grep "(no matches)"
|
|
# CHECK: (no matches)
|
|
isolated-tmux send-keys Enter C-e C-u "echo foo" Enter
|
|
tmux-sleep
|
|
isolated-tmux capture-pane -p | grep "^foo\|prompt 7>"
|
|
# CHECK: foo
|
|
# CHECK: prompt 7>
|