Bug 206709

Summary: "Clear Scrollback & Reset" feature doesn't work with zsh prompt
Product: [Applications] konsole Reporter: Nicholas Tung <gatoatigrado>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED LATER    
Severity: wishlist CC: pano_90, robertknight, saschpe
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Unspecified   
Latest Commit: Version Fixed In:

Description Nicholas Tung 2009-09-08 04:56:24 UTC
Version:            (using Devel)
Installed from:    Compiled sources

When switching Konsole's shell to zsh (settings / edit current profile / set command to "/usr/bin/zsh"), the "Clear Scrollback & Reset" feature (ctrl+shift+x) kills the shell prompt ("username@machine:directory>") as well. Very occasionally -- I'm not sure what causes it -- it will work correctly.
Comment 1 Robert Knight 2009-09-08 14:57:59 UTC
Konsole unfortunately does not know which of the text on the screen is the shell and which is other data that should be cleared.

It uses a trick of jiggling the size of the screen after clearing the display which causes Bash to redraw its shell.  That does not work with zsh though.

A possible fix might be to try keeping the contents of the line containing the cursor - although that might cause some odd behavior.
Comment 2 Nicholas Tung 2009-09-08 23:25:46 UTC
Hmm... echo -n "asdf" and then changing the width causes zsh to redraw its prompt. Could you provide more details?

Thanks,
Nicholas
Comment 3 Robert Knight 2009-09-09 11:59:49 UTC
> Hmm... echo -n "asdf" and then changing the width causes zsh
> to redraw its prompt. Could you provide more details?

When you press Ctrl+Shift+X Konsole clears the display and resets the state of the terminal and then jiggles the size of the window by sending a couple of 'signals' to the shell:

window_size_changed(current_lines,current_columns+1)
window_size_changed(current_lines,current_columns-1)

This causes bash to redraw the prompt.  That does not appear to work for zsh.  I have not investigated the issue in more detail.  Suggestions welcome although they would ideally have to work for bash as well since Konsole does not always know which shell is currently being used.
Comment 4 Panagiotis Papadopoulos 2010-03-06 19:49:57 UTC
I am "suffering" from this bug too :-P
Hope this gets fixed at some point
Comment 5 Sascha Peilicke 2010-04-22 12:57:45 UTC
The same happens when using tcsh. BTW. gnome-terminal fails on this too, so this is maybe better filed upstream.