Open ryuukk opened 10 months ago
It is working as intended. 2
should only erase the viewport and 3
would erase the scrollback history.
See https://xtermjs.org/docs/api/vtfeatures/#csi
0 | Erase from the cursor through the end of the viewport.
-- | --
1 | Erase from the beginning of the viewport through the cursor.
2 | Erase complete viewport.
3 | Erase scrollback.
Who is right? xtermjs, or windows terminal, msys terminal and other tools?
vt510 doesn't have the concept of scrollback history. We should unleast reference xterm.
https://www.xfree86.org/current/ctlseqs.html
Of course, Windows terminal may have evolved differently as xterm and inconsistency is expected. Terminus would follow xterm's standard in case of having any inconsistency.
By the way, it also depends on the clear
program that you use. Some clear program will emit \e[3J
and some will emit \e[2J
.
Options from clear
Options:
-T TERM use this instead of $TERM
-V print curses-version
-x do not try to clear scrollback
If -x tries to not clear scrollback, what does not calling it with -x supposed to do according to clear?
it prints:
\033[H\033[2J\033[3J
So 3 is there, why does terminus stops at 2?
Calling it with -x prints
\033[H\033[2J
So you may be right, however, terminus stopping at 2 and not handling 3, wich is present, is a bug right?
printf '\033[H\033[2J\033[3J'
does clear the scroll back history for me (in bash and zsh / macOS).
I am using Windows, in cmd to clear the entire cmd I have to use "cls" instead of "clear". However, in terminus "cls" only scroll down to the cursor instead of clearing all the display.
I am using Windows, in cmd to clear the entire cmd I have to use "cls" instead of "clear". However, in terminus "cls" only scroll down to the cursor instead of clearing all the display.
That's because cls
prints ASCII 0x0C (<FF>
- form feed) unless cmd.exe
is connected to stdout:
printf("\014"); // ^L
return 0;
Neither Windows Terminal nor conhost.exe
implement CSI 3 J
. CSI 2 J
works as intended.
0 = clear display from cursor to end, therefore it needs history
however
2 = clear entire display
On windows when using git bash,
clear
didn't clear the entire display, it put back the history therefore you could always scroll backIf you use the provided terminal emulator (from msys), calling
clear
clear the entire display, so that's the proper behavior, same when using Windows TerminalWith this PR
clear
now behaves properly with TerminusFix #120, #340 and probable some other issues
There is also this line in the code base that looks suspicious:
https://github.com/randy3k/Terminus/pull/399/files#diff-1ff8d95a5f63ac2d193b501633246f1211a04d98c4ef04782ddd5a9a1dc327b3R390-R392