Add a clear-screen bind function to clear the screen#10044
Add a clear-screen bind function to clear the screen#10044faho merged 4 commits intofish-shell:masterfrom
Conversation
This can be bound like `bind \cl clear-screen`. In contrast to the current way it doesn't need the external `clear` command that was always awkward. Also it will clear the screen and first draw the old prompt to remove flicker. Then it will immediately trigger a repaint, so the prompt will be overwritten.
|
I'm reasonably sure the test failure is down to $TERM/terminfo being wrong on these machines, and so it doesn't do anything. I'm not sure why |
|
Ah, this was a crash - This should really be shown in pexpect, also the test that failed doesn't really check clearing because the pexpect tests are run with TERM=dumb. |
This would have been helpful in #10044: > signals.py:28: SIGNAL SIGSEGV from expect_prompt() instead of "EOF".
|
Seems fine to me - though I use the terminal's clear function which also clears scrollback. |
That is of course a valid choice. We already removed scrollback clear from It would be possible to add a "repaint-old" function that repaints without reexecuting. This would allow you to add a fast repaint after your clear by doing So I chose this version because skipping the awkward |
This can be bound like `bind \cl clear-screen`, and is, by default In contrast to the current way it doesn't need the external `clear` command that was always awkward. Also it will clear the screen and first draw the old prompt to remove flicker. Then it will immediately trigger a repaint, so the prompt will be overwritten. (cherry picked from commit c4ca1a6)
Description
This adds a bind function called
clear-screenand binds it to ctrl+l by default, removing the rather awkward invocation of theclearcommand.What that does is:
This makes for a smooth experience removing any flicker, and still leaves an up-to-date prompt (eventually, once it comes through).
I've tested this with TERM=dumb (it'll do nothing) and with an awkwardly slow prompt - it will show the old prompt, won't react to input and then update the prompt and the commandline.
TODOs: