Bug 453568 - "clear scrollback and reset" places cursor at wrong position
Summary: "clear scrollback and reset" places cursor at wrong position
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 22.04.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-09 07:57 UTC by Martin Koller
Modified: 2022-05-16 22:58 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Koller 2022-05-09 07:57:25 UTC
when I activate above action, the cursor is placed at 0,0 but to its right then there is the command prompt,
leading to overwriting the the newly typed chars above the prompt.
This was not an issue with the previous version.
Comment 1 ninjalj 2022-05-13 10:53:57 UTC
Which shell are you using? Do you use any shell extension/plugin (ohmyzsh, powerlevel10k, ...)? Any other non-standard configuration of the prompt?
Comment 2 Martin Koller 2022-05-13 12:07:21 UTC
I use tcsh (no extension/plugins) and the prompt is set to
set prompt='%{^[[1m^[[34m%}[%c5]#%{^[(B^[[m%} '
Comment 3 Kurt Hindenburg 2022-05-16 22:58:28 UTC
Git commit 9dadb7b562e9ecbffa107c9fcd2616661dbe626f by Kurt Hindenburg, on behalf of Luis Javier Merino Morán.
Committed on 16/05/2022 at 22:51.
Pushed by hindenburg into branch 'master'.

Fix regression preserving tcsh command prompt

Commit c3b3ef19 introduced a regression when invoking the
clear-history-and-reset action.  While RIS (Reset to Initial State) is
specified in DEC STD-070 as homing the cursor, konsole has grown some
hacks in the name of usability to preserve the command prompt line.

For a long time, it has sent two SIGWINCH with changed sizes after clear
and reset actions to force the shell to redraw the prompt (see d346a2cc,
temporarily disabled on 5d61b69e and re-added on 82778e87), which works
for bash, zsh, ksh, ...

tcsh doesn't redraw its prompt on SIGWINCH, but commit b8e96bcd modified
Screen::refresh() so instead of clearing the entire screen and homing
the cursor, it scrolled up everything but the last (usually the prompt)
line.

So, keep that last hack when called from clear-history-and-reset, and
behave as specified on DEC STD-070 otherwise.

Note that other ways of clearing the screen don't need hacks, e.g.
Ctrl-L, if handled at all, is handled by the shell, which then redraws
its prompt.  Calling "clear" or invoking "printf '\ec'" will result in
the shell redrawing its prompt in the usual way.

M  +3    -2    src/Emulation.h
M  +13   -8    src/Screen.cpp
M  +6    -3    src/Screen.h
M  +3    -3    src/Vt102Emulation.cpp
M  +1    -1    src/Vt102Emulation.h
M  +1    -1    src/session/SessionController.cpp

https://invent.kde.org/utilities/konsole/commit/9dadb7b562e9ecbffa107c9fcd2616661dbe626f