CSI 2J: Do not append current screen to history
ClosedPublic

Authored by mglb on May 19 2019, 1:06 AM.

Details

Summary

This behavior is present in e.g. xterm and linux console.

Currently when using CSI 2J escape sequence, screen contents are
appended to scrollback (including bottom empty lines). This is breaking
clear command, which replaces scrollback with current screen contents.

BUG: 384218

Test Plan
  • Start Konsole with a shell
  • clear

Expected result:
Cleared display, empty scrollback.
Actual result:
Cleared display, but scrollback contains previous display contents.


  • Start Konsole with a shell
  • seq 1000
  • echo -ne '\033[2J

Expected result:
Cleared display, numbers in last scrollback lines.
Actual result:
Cleared display, but scrollback contains previous display contents
(i.e. shell prompt in last lines)

Diff Detail

Repository
R319 Konsole
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mglb created this revision.May 19 2019, 1:06 AM
Restricted Application added a subscriber: konsole-devel. · View Herald TranscriptMay 19 2019, 1:06 AM
mglb requested review of this revision.May 19 2019, 1:06 AM

Thanks let me look at this week

mglb added a comment.Jun 15 2019, 11:31 AM

Note that ncurses devs recently decided to fix clear (https://bugzilla.gnome.org/show_bug.cgi?id=506438#c19), so on newer systems it will work even with current CSI2J behavior.
This lowers reasons behind this path to compatibility with clear in older systems and compatibility with xterm. If these goals are not important, the patch can be abandoned.

hindenburg accepted this revision.Jun 15 2019, 8:53 PM

I'm fine with adding this.

This revision is now accepted and ready to land.Jun 15 2019, 8:53 PM
This revision was automatically updated to reflect the committed changes.