After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 678042 - support CSI 3J ?
support CSI 3J ?
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-13 16:39 UTC by Christian Persch
Modified: 2014-12-28 22:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add support for CSI 3J (8.65 KB, patch)
2014-12-25 18:00 UTC, Egmont Koblinger
needs-work Details | Review
Add support for CSI 3J, v2 (8.65 KB, patch)
2014-12-26 10:17 UTC, Egmont Koblinger
none Details | Review

Description Christian Persch 2012-06-13 16:39:48 UTC
Linux console supports CSI J with parameter 3 to clear the scrollback as well [1]; maybe vte should support that too? Code is in vte_sequence_handler_erase_in_display().

[1] https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commit;h=f8df13e0a901fe55631fed66562369b4dba40f8b
Comment 1 Christian Persch 2013-11-29 12:29:29 UTC
xterm also supports this, and ncurses emits it from the 'clear' command.

CSI Ps J  Erase in Display (ED).
            Ps = 0  -> Erase Below (default).
            Ps = 1  -> Erase Above.
            Ps = 2  -> Erase All.
            Ps = 3  -> Erase Saved Lines (xterm).
Comment 2 Egmont Koblinger 2014-03-17 23:37:08 UTC
Relevant: https://bugzilla.redhat.com/show_bug.cgi?id=1035807
Apparently Fedora's "clear" command emits this escape sequence.
Comment 3 Egmont Koblinger 2014-12-25 16:01:13 UTC
Note: Linux console and xterm differ in behavior. Linux console clears the scrollback and the onscreen contents. Xterm clears the scrolled out contents only, leaves the onscreen bits intact.

Putty and konsole also follows xterm; I think we should too.

Also note that only the first numeric argument is taken into account, e.g. "CSI 3;J", "CSI 3;0J", "CSI 3;1J" etc. are all equivalent to "CSI 3J", i.e. leave the onscreen contents unchanged (following the spirit of bug 741402).
Comment 4 Egmont Koblinger 2014-12-25 18:00:43 UTC
Created attachment 293341 [details] [review]
Add support for CSI 3J

Here's an implementation.

I've verified that the streams are actually reset, i.e. even with the infinite scrollback case the files are truncated to 0 size.

In combination with bug 506438 the behavior of the "clear" command is a bit weird, effectively it leaves one pageful of data in the scrollback. (First it emits CSI 3;J which wipes out the scrollback. Then with CSI H it homes the cursor. Finally with CSI 2J it clears everything under the cursor - which in vte scrolls by a pageful of lines.) This deviates from xterm, and is the same as konsole.
Comment 5 Egmont Koblinger 2014-12-26 10:08:00 UTC
Review of attachment 293341 [details] [review]:

::: src/ring.c
@@ +628,3 @@
+_vte_ring_drop_scrollback (VteRing * ring, gulong position)
+{
+        g_assert(ring->writable <= position);

clear; maximize window; clear => this fails
Instead of assertion we'd need an ensure_writable
Comment 6 Egmont Koblinger 2014-12-26 10:17:53 UTC
Created attachment 293351 [details] [review]
Add support for CSI 3J, v2
Comment 7 Egmont Koblinger 2014-12-28 22:55:01 UTC
Split change into two; submitted.