Kitty: 'clear' does not clear the scrollback buffer

Created on 6 Jan 2018  路  12Comments  路  Source: kovidgoyal/kitty

shell clear command should clear the scrollback as well.
peek 2018-01-06 15-14

Most helpful comment

Also, since I came here looking for this and others might be interested, the following works [1, 2] to clear the screen and scrollback buffer in kitty, iTerm2, Apple Terminal, and presumably other Linux terminals (which I do not have at hand to test right now):

printf '\033[2J\033[3J\033[1;1H'

All 12 comments

No, it should not. clear clears only the screen.

To be precise clear clears the scrollback buffer only if the E3 capability is defined, which kitty does not define.

And just for fun, surveying terminal behavior:
Terminals that use clear to clear scrollback
xterm, linux console, putty
Terminals that use clear to clear only the screen:
kitty, konsole, urxvt, all VTE based terminals such as gnome terminal

And with this commit, https://github.com/kovidgoyal/kitty/commit/1ef010689dd8dc24f658f870d34453b42304cf52

you can use

printf '\E[H\E[3J'

to clear the scrollback buffer as well as the screen, if you need to.

Also, since I came here looking for this and others might be interested, the following works [1, 2] to clear the screen and scrollback buffer in kitty, iTerm2, Apple Terminal, and presumably other Linux terminals (which I do not have at hand to test right now):

printf '\033[2J\033[3J\033[1;1H'

@spl it works as expected on kitty. How can I map it with cmd+k key on mac ?
I tried map cmd+k printf '\033[2J\033[3J\033[1;1H' and map super+k send_text all printf '\033[2J\033[3J\033[1;1H' with no success :|

@collegeimprovements - did you figure out how to map it to cmd+k?

@collegeimprovements @OmisNomis Escape the ' and \:

map cmd+k send_text normal printf \'\\033[2J\\033[3J\\033[1;1H\'\x0d

Edit: As mentioned in #747, this also works:

map cmd+k combine : clear_terminal scrollback active : send_text normal \x0c

@nkouevda - Thanks. Unfortunately map cmd+k combine : clear_terminal ..... has weird behaviour when text has been used (see gif below).

Escaping the ' and \ also didn't work - when using cmd+k, nothing happens.

screencast 2020-01-06 09-37-17

So... how does one clear the scrollback (especially when looking at a running process)?
Edit: Ah, default binding of ctrl+shift+delete does what I need

On macOS it's working on my machine with map ctrl+k combine : clear_terminal active : send_text normal \x0c

Hmm this is interesting: ctrl+shift+delete does clear the scrollback, but it doesn't de-allocate the ram storage. Perhaps this should be a new issue

Was this page helpful?
0 / 5 - 0 ratings