Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear screen + scrollback via Cmd+K on macOS #4625

Closed
jab opened this issue Feb 3, 2022 · 6 comments
Closed

Clear screen + scrollback via Cmd+K on macOS #4625

jab opened this issue Feb 3, 2022 · 6 comments

Comments

@jab
Copy link

jab commented Feb 3, 2022

Both Terminal.app and iTerm.app on macOS come with the Command+K keyboard shortcut for clearing the screen and all the scrollback. Out of 15+ years of muscle memory, I keep hitting Cmd+K in Kitty to clear and then get [107;9u printed instead. What do you think of adding this default shortcut to Kitty.app, so it's that much easier for users migrating from Terminal and iTerm?

Thanks for your consideration and for the great work on Kitty!

@jab jab added the enhancement label Feb 3, 2022
@kovidgoyal
Copy link
Owner

You can add them for yourself in kitty.conf
https://sw.kovidgoyal.net/kitty/conf/#shortcut-kitty.Reset-the-terminal

@page-down
Copy link
Contributor

page-down commented Feb 4, 2022

I'm curious how the other terminals are implemented.

I tested Terminal.app (Clear to Start) and iTerm2 (Clear Buffer) and their Cmd+K doesn't seem to reset, it just clears the scrollback.
It maintains the last prompt after pressed (not sure if it's redrawn).

Pressing it in a program such as vim will clear it all in iTerm2.
In Terminal.app the line where the cursor is still displayed is preserved. It looks pretty broken to me.

After exiting vim, iTerm2 has some leftover scrollback from the previous shell and the cursor is in an abnormal position. For Terminal.app, the scrollback of the shell are empty lines.

Yes. It can be configured by the user.
But here is a suggestion if such a default shortcut could be considered.

@page-down
Copy link
Contributor

page-down commented Feb 4, 2022

Since we have marked shell prompt, is it possible to clean up to the line before the marker?
This will preserve the last prompt.

EDIT:
I tried the latest changes and the prompt is currently cleared as well, with the cursor in the middle of the line and empty before and after.

@kovidgoyal
Copy link
Owner

Sure should be a simple patch, a PR is welcome. You check if the screen
has an active marked prompt and then scroll upto there, if not fallback
to scrolling upto the cursor line

@page-down
Copy link
Contributor

Thank you, I see that it has been implemented.
Comparing different terminals, this feature is functioning properly.
And it works well with multi-line prompt.

@jab
Copy link
Author

jab commented Feb 4, 2022

Thanks for adding this so quickly! This will make the Kitty experience on Mac even more 😻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants