pressing CMD-K will clear the entire display buffer leaving only the last line,
so if you are editing a long command, only the last part of that command is preserved,
the prompt string however, is lost. Older version of iTerm(2.1.4) circumvent this problem
by clearing to explicit line feed boundaries. I think a better approach is to send a
SIGWINCH signal so the shell can handle redrawing them self, and this way, iTerm can
just throw away ALL display buffer instead of manually persevering the last line.
shell-integration not working properly, which can be reproduced by the following step:
Install shell-integraton for zsh, I'm running zsh 5.2 (x86_64-apple-darwin14.5.0) on
OSX 10.10.5, then restart iTerm.
Now type 'sleep 10' and then after command start executing, press Ctrl-C.
(this is step 2.1)
This time it works fine(with a BUG that produces an extra blank line #4481),
as shown in the following image:
then press CMD-K, noticed that the small blue triangle is lost(problem 2.1):
this is also one of the reasons why I suggested sending of a SIGWINCH after CMD-K
then redo step 2.1, noticed that the small triangle is displaying a wrong color
(problem 2.2):
and right clicking the triangle is also not working.
simulate a SIGWINCH after CMD-K fixes problem 2.1, but won't fix problem 2.2
@gnachman tcsh? Never used that one, it won't even redraw prompt string upon SIGWINCH?
So maybe we read from $SHELL to test if it's tcsh, fallback to old mode, use SIGWINCH in all other cases?
Maybe that's not an important problem, come to think about it. We can clear the screen the same way we do today and do TIOCGWINSZ. If the shell redraws its prompt, great, if not too bad.
I've implemented this in commit 2a79e990 but it's off by default. You can enable it with Prefs > Advanced > Redraw the screen after the Clear Buffer menu item is selected in the General category.
It's off by default because there are possible privacy issues.
@gnachman I'm using 2.9.20160426, zsh 5.2(installed from homebrew), on OSX 10.10.5.
I've selected "Redraw the screen after the Clear Buffer menu item is selected".
Still, after clearing buffer, shell prompt is not redrawn, however, manually resize the window do redraw it.