Skip to content

Commit

Permalink
Make new ctrl-l logic more portable
Browse files Browse the repository at this point in the history
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.")
  • Loading branch information
mqudsi committed Jan 4, 2025
1 parent 7eb254f commit d749074
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion share/functions/__fish_shared_key_bindings.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d749074

Please sign in to comment.