Is there a way to clear screen and save contents in scrollback? #4446
Replies: 5 comments 6 replies
-
note: You already asked this question last year ^^ @wez replied at the time he didn't want this (non-conform) behavior in Wezterm.
Might need some debugging here, see where it's not working exactly. |
Beta Was this translation helpful? Give feedback.
-
The bash bind has limitations which do not work on remote shell. It will be great if Wezterm can implement this feature. |
Beta Was this translation helpful? Give feedback.
-
Second this, It would be great to have a feature that allows us to clear the viewport without impacting the scrollback buffer. |
Beta Was this translation helpful? Give feedback.
-
I think there is some confusion around this functionality. There is an
Separately, there is a command line utility called Separately, many line editors have a keyboard shortcut for For the folks above that seem to be asking for a way to clear the viewport without impacting the scrollback: I would expect that to the default in most software, and you will need to check your configuration to see where you may have something configured that behaves differently. This issue and the other original question were asking for different behavior, which is to move the viewport into the scrollback and then tidy up the viewport. wezterm doesn't have an escape sequence for this non-standard behavior, but you can script that behavior for yourself; it works by moving the cursor down enough rows that the current viewport is shifted into the scrollback, then injects the CTRL-L keypress which causes most software to clear and re-render the viewport: local wezterm = require 'wezterm'
local config = wezterm.config_builder()
config.keys = {
{key='K', mods='CTRL|SHIFT', action=wezterm.action_callback(function(window, pane)
local pos = pane:get_cursor_position()
local move_viewport_to_scrollback = string.rep('\r\n', pos.y)
pane:inject_output(move_viewport_to_scrollback)
pane:send_text('\x0c') -- CTRL-L
end)}
}
return config |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
What Operating System(s) are you running on?
Linux Wayland
Which Wayland compositor or X11 Window manager(s) are you using?
No response
WezTerm version
20230712-072601-f4abf8fd
Ask your question!
I want to clear the screen and later scrollback to check the contents.
After some investigation I found binding
\e[nS
and\e[nA
(n is for n lines) toCtrl+L
in Wezterm can implement this feature, this works in Linux, but does not work in Windows.Kitty has following in the document: https://sw.kovidgoyal.net/kitty/conf/#shortcut-kitty.Reset-the-terminal
I know Wezterm has ClearScrollback action, want to ask whether Wezterm can add ClearScreen action with above behaviors.
https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearScrollback.html
Beta Was this translation helpful? Give feedback.
All reactions