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

Feature req: clear scroll buffer action #2081

Closed
alaricljs opened this issue Jan 10, 2023 · 6 comments · Fixed by #2239
Closed

Feature req: clear scroll buffer action #2081

alaricljs opened this issue Jan 10, 2023 · 6 comments · Fixed by #2239
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@alaricljs
Copy link

One of the terminal features I use often that I feel would make sense in zellij is clearing a pane's scrollback buffer. I do a lot of multi system management and clear my buffer every time I switch to a new task. This is less work than restarting the terminal (or in zellij replacing the current pane).

@imsnif imsnif added help wanted Extra attention is needed good first issue Good for newcomers labels Jan 13, 2023
@raphCode
Copy link
Contributor

raphCode commented Jan 17, 2023

For me, the reset command does the trick.

@alaricljs
Copy link
Author

alaricljs commented Jan 17, 2023

Interesting. While it technically solves my request it takes a full 1s to return whereas a purpose built method should be near instant and would not frustrate the typical impatient user.

@raphCode
Copy link
Contributor

raphCode commented Jan 17, 2023

Fair. reset does a lot of things and deliberate calls nanosleep afterwards. Probably terminals were a lot slower when the command was written.
Try clear or tput reset for a faster version.

@raphCode
Copy link
Contributor

Nice, I am putting this in my bashrc right now:
bind -x $'"\C-l":clear;'

This does the requested operation instantly on Ctrl-L.

https://stackoverflow.com/a/29844745

@thekief
Copy link

thekief commented Jan 21, 2023

For me clear does not clear the scrollback buffer on macOS (arm64) for whatever reason but reset does the trick. I imagine a built-in function is probably still the best solution in the long-term.

@raphCode
Copy link
Contributor

Interesting. On my machine, tput and clear come from the ncurses package.

In fact, the function you want is already is already integrated in zellij and can be triggered by writing the correct escape sequences to the terminal. For example, like clear is doing that with
^[[H^[[2J^[[3J

I attached the sequence below for convenience, you can cat it in your terminal.
clear.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants