diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 805812fa5..f44d3dbbc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -27,7 +27,7 @@ New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ - :kbd:`ctrl-z` (undo) after executing a command will restore the previous cursor position instead of placing the cursor at the end of the command line. - The OSC 133 prompt marking feature has learned about kitty's ``click_events=1`` flag, which allows moving fish's cursor by clicking. -- :kbd:`ctrl-l` no longer clears the screen but only pushes to the terminal's scrollback all text above the prompt (via a new special input function ``scrollback-push``). +- :kbd:`ctrl-l` now pushes all text located above the prompt to the terminal's scrollback, before clearing and redrawing the screen (via a new special input function ``scrollback-push``). This feature depends on the terminal advertising via XTGETTCAP support for the ``indn`` and ``cuu`` terminfo capabilities, and on the terminal supporting Synchronized Output (which is used by fish to detect features). If any is missing, the binding falls back to ``clear-screen``. diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index fdfdbb727..2677edda5 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -66,7 +66,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod bind --preset $argv alt-l __fish_list_current_token bind --preset $argv alt-o __fish_preview_current_file bind --preset $argv alt-w __fish_whatis_current_token - bind --preset $argv ctrl-l scrollback-push repaint + bind --preset $argv ctrl-l scrollback-push clear-screen bind --preset $argv ctrl-c clear-commandline bind --preset $argv ctrl-u backward-kill-line bind --preset $argv ctrl-k kill-line diff --git a/src/reader.rs b/src/reader.rs index 058c730c5..f9c792a74 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -3742,7 +3742,6 @@ impl<'a> Reader<'a> { } rl::ScrollbackPush => { if !SCROLL_FORWARD_SUPPORTED.load() || !CURSOR_UP_SUPPORTED.load() { - self.clear_screen_and_repaint(); return; } match self.cursor_position_wait() { @@ -3750,7 +3749,7 @@ impl<'a> Reader<'a> { &mut Outputter::stdoutput().borrow_mut(), CursorPositionWait::Blocking(CursorPositionBlockingWait::ScrollbackPush), ), - CursorPositionWait::InitialFeatureProbe => self.clear_screen_and_repaint(), + CursorPositionWait::InitialFeatureProbe => (), CursorPositionWait::Blocking(_) => { // TODO: re-queue it I guess. FLOG!( diff --git a/tests/checks/tmux-scrollback.fish b/tests/checks/tmux-scrollback.fish index 28bb350e1..a2a977e3c 100644 --- a/tests/checks/tmux-scrollback.fish +++ b/tests/checks/tmux-scrollback.fish @@ -2,7 +2,7 @@ #REQUIRES: command -v tmux isolated-tmux-start -isolated-tmux send-keys 'bind ctrl-g "commandline -f scrollback-push scrollback-push"' Enter C-g +isolated-tmux send-keys 'bind ctrl-g "commandline -f scrollback-push scrollback-push clear-screen"' Enter C-g tmux-sleep isolated-tmux capture-pane -p # CHECK: prompt 1>