Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSI 2 J works in unexpected way #2860

Closed
Luit opened this issue Apr 20, 2020 · 4 comments
Closed

CSI 2 J works in unexpected way #2860

Luit opened this issue Apr 20, 2020 · 4 comments

Comments

@Luit
Copy link

Luit commented Apr 20, 2020

In VS Code I've noticed the behavior of Ctrl-L being different from what I was used to. Mainly compared to Gnome Terminal, but I've never really noticed terminal emulators handling this differently.

Ctrl-L or tput -x clear (or clear -x) run CSI H followed by CSI 2 J. In Gnome Terminal this results in everything that's in the current display to be scrolled out of view. In VS Code this results in everything in the current view being erased from the scrollback instead.

Details

  • Browser and browser version: Electron (VS Code 1.44.2)
  • OS version: Linux
  • xterm.js version: VS Code 1.44.2 (not exactly sure which xterm.js version that is)

Steps to reproduce

  1. In a new terminal, run clear -x/tput -x clear
  2. Scroll up.

In Gnome terminal, the line with clear -x/tput -x clear is there on the scrollback. In xterm.js, there's nothing there.

If it's not a new terminal (e.g. run seq 100 first) the last line found in the scrollback will be the last line that was out of view before the clear ran.

@theflyingape
Copy link
Contributor

I think it matters to what your environment TERM is set as, i.e., vt220 behaves differently than xterm and xterm-256color.

@Luit
Copy link
Author

Luit commented Apr 20, 2020

In all of the situations described above, TERM=xterm-256color. To make sure I've also tried sending the CSI directly with echo -ne "\033[H\033[2J", yielding the same results.

@Luit
Copy link
Author

Luit commented Apr 20, 2020

In Gnome Terminal the CSI H CSI J sequence (tput -Tvt220 -x clear) appears to work identically to CSI H CSI 2 J in xterm.js, clearing everything in display, leaving any scrollback intact.

@Tyriar
Copy link
Member

Tyriar commented Apr 20, 2020

duplicate of #1727

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants