From d7490741dd479b9c5deaaa02bd3309749c0b82db Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 4 Jan 2025 11:35:04 -0600 Subject: [PATCH] Make new ctrl-l logic more portable The behavior of the new scrollback-push is not consistent across various terminals and the functionality of ctrl-l is too important to break in the default bindings. This hack should preserve the benefits of scrollback-push while keeping the portability of the old clear-screen: first we ask the terminal to scroll everything offscreen *then* we clear the screen. The addition of clear-screen should be a no-op on any terminal that fully supports the desired behavior of invoking the new scrollback-push. (There are no performance-related concerns with ctrl-l.) This handles multiple possible issues (observed or otherwise) with scrollback-push: * The screen contents are pushed back into scrollback but the screen isn't cleared (observed under Prompt/iOS) * Cursor position reporting isn't supported * SF isn't supported * UP isn't supported ("Only a few terminal descriptions provide these commands, and most programs do not use them.") --- share/functions/__fish_shared_key_bindings.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index c2d64e92a10b..a5280c1c99e5 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 cancel-commandline bind --preset $argv ctrl-u backward-kill-line bind --preset $argv ctrl-w backward-kill-path-component