From afdd1a98c12f2712759f91a2e22f9981571838e5 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 12 Feb 2017 11:58:06 +0100 Subject: [PATCH] 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. --- CHANGELOG.md | 1 + share/functions/__fish_shared_key_bindings.fish | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ff1b1ac4..1ad479cd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # 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 \cl binding no longer deletes the scrollback buffer with ncurses >= 6.0 (#2855). --- diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index 9230c60a9..8282afa81 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -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 \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 \cu backward-kill-line bind $argv \cw backward-kill-path-component