From d4d77d45f298349cad18db1aa113907738f84a4c 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 real 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, FreeBSD console session) * termcap SF isn't supported * termcap UP isn't supported ("Only a few terminal descriptions provide these commands, and most programs do not use them.") It still breaks in an ugly way if terminal position reporting isn't supported, but I'll address that separately. --- 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