[konsole] [Bug 427577] Ctrl+Shift+K (Clear Scrollback and Reset) causes TTY to report incorrect size

Roman Perepelitsa bugzilla_noreply at kde.org
Mon Oct 12 11:43:24 BST 2020


https://bugs.kde.org/show_bug.cgi?id=427577

--- Comment #3 from Roman Perepelitsa <roman.perepelitsa at gmail.com> ---
Thanks for the context.

This hack causes issues when the content of prompt depends on the terminal
dimensions. Here's an example:

    PROMPT=$'${(pl.$((COLUMNS))..-.)}\n> ' zsh -f --promptsubst

If you run this command in Konsole and press Ctrl+Shift+K, you'll see a
duplicate line at the top.

This problem would be avoided if Ctr+Shift+K cleared scrollback and sent `^L`
to the shell. This solution would rely on the shell being able to redraw its
prompt upon receiving `^L`, which is not guaranteed in general. On the other
hand, it's also not guaranteed that the shell redraws its prompt upon receiving
SIGWINCH.

FWIW, Clear Scrollback and Reset can be implemented in Zsh in terminal-agnostic
manner.

    function clear-screen-and-scrollback() { printf '\e[3J' >$TTY && zle
clear-screen }
    zle -N clear-screen-and-scrollback
    # Ctrl+Alt+k -- Clear Scrollback and Reset.
    bindkey '^[^k' clear-screen-and-scrollback

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the konsole-devel mailing list