Don't clear scrollback with the \cl binding

ncurses since 6.0 sends the "E3" sequence along with "clear", even for
just `clear` or `tput clear`. This deletes the scrollback buffer which
is usually not what you want.

Fixes #2855.
This commit is contained in:
Fabian Homborg 2017-02-12 11:58:06 +01:00
parent 9cae25d1eb
commit afdd1a98c1
2 changed files with 4 additions and 1 deletions

View file

@ -1,6 +1,7 @@
# fish 2.6.0 (released ???) # fish 2.6.0 (released ???)
- The `read` command now has a default limit of 10 MiB. If a line is longer than that it will fail with $status set to 122 and the var will be empty. You can set a different limit by setting the FISH_READ_BYTE_LIMIT variable. - The `read` command now has a default limit of 10 MiB. If a line is longer than that it will fail with $status set to 122 and the var will be empty. You can set a different limit by setting the FISH_READ_BYTE_LIMIT variable.
- The \cl binding no longer deletes the scrollback buffer with ncurses >= 6.0 (#2855).
--- ---

View file

@ -77,7 +77,9 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
bind $argv \el __fish_list_current_token bind $argv \el __fish_list_current_token
bind $argv \ew 'set tok (commandline -pt); if test $tok[1]; echo; whatis $tok[1]; commandline -f repaint; end' bind $argv \ew 'set tok (commandline -pt); if test $tok[1]; echo; whatis $tok[1]; commandline -f repaint; end'
bind $argv \cl 'clear; commandline -f repaint' # ncurses > 6.0 sends a "delete scrollback" sequence along with clear.
# This string replace removes it.
bind $argv \cl 'clear | string replace \e\[3J ""; commandline -f repaint'
bind $argv \cc __fish_cancel_commandline bind $argv \cc __fish_cancel_commandline
bind $argv \cu backward-kill-line bind $argv \cu backward-kill-line
bind $argv \cw backward-kill-path-component bind $argv \cw backward-kill-path-component