question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Atypical "Erase In Display" behaviour

See original GitHub issue

Most terminals seem to implement ED (specifically \x1b[2J) by not actually deleting anything from the display buffer, but rather by scrolling. Conversely, xterm.js does delete the display buffer’s contents, which is a) inconsistent and b) annoying because you lose output. I don’t think this behaviour qualifies as a bug because the spec doesn’t say about what should happen with the scrollback buffer, but would still be nice if this were changed.

Downstream issue in https://github.com/JunoLab/atom-julia-client/issues/521.

Details

  • Browser and browser version: Electron 2.0.8
  • OS version: Manjaro
  • xterm.js version: master (but also at least 3.6 and 3.7)

Steps to reproduce

Try

for i in {1..20}; do
  echo "$i"
done
echo '\e[1;1H\e[2J'

in xterm.js and another terminal emulator, and scroll up afterwards.

image Expected behaviour is what e.g. Konsole does (middle window), and not how e.g. VSCode (left) or Juno’s terminal (right, with xterm.js master) handles this.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
jerchcommented, Jun 3, 2021

Reading through the bugtracker comments in vte and konsole raises alot of questions regarding scrolling out, and make me think whether this is a good idea at all:

ED2 was never meant to do that, its purpose is to erase content on the active viewport in the sense of “clean that area”, nothing more. In fact apps might use it do full screen refreshs to start over drawing. I use it myself that way in several fullscreen scripts. Now if such an app does not switch to alternate buffer, it will dump every screen refresh into the scrollbuffer. The semantics are broken further by the fact, that ED1 does not add anything to the scrollbuffer. But why? By the spec description ED0 + ED1 should be equivalent to ED2, but it isnt anymore for scroll-out terminals. So semantically adding changes to the scrollbuffer for ED was a mistake, no clue who broke with the spec initially. Furthermore with SU (scroll up, CSI <rows> S) we already have an appropriate sequence for it. No need to water other sequences.

Now regarding whether this is common or not. I see that all OSX terminals I know do that, even Terminal.app. Under POSIX terminal emulators in general it is not that common - xterm (the father of all xterm-alikes and thus most common graphical TEs) doesnt do it, neither do the kernel consoles (tested linux and FreeBSD). The latter are more on the legacy side of things, but considering the semantic issues above, I am not so sure anymore if coupling scrollbuffer changes to ED2 was a great idea.

TL;DR After reading through the bugtracker and concerns listed there, I lean towards not implementing scrollout for ED2. It breaks horribly the sequence semantics and the basic unix principle “do one thing and do it right”. If ppl want scroll out, use the appropriate sequence for it (SU). All imho and up for discussion.

1reaction
pjlsergeantcommented, Jun 7, 2021

For many people, xterm.js will be the only terminal they use that doesn’t do it “properly”. Could this behaviour be behind a flag / OS check?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Character Analysis on the show Atypical - Emyli Arauz ...
The show highlights struggles like friends, romance, and transitions like going to college. We see Sam's behaviors and social norms he lives ...
Read more >
Consistency of behavior across situations. a Example of ...
Inset displays ranks instead of values with the correlation line. e, ... Consistency of behavior across situations. a Example of atypical behaviors.
Read more >
Depression With Atypical Features: Diagnostic Validity ... - NCBI
According to DSM-IV diagnostic criteria (“atypical features” specifier), the disorder is primarily characterized by 2 or more of the following symptoms as ...
Read more >
Atypical behaviours Flashcards | Chegg.com
Behaviour that is considered abnormal because it applies to the minority of ... there is evidence to show that some people are more...
Read more >
Atypical Depression Symptoms, Treatments, and Diagnosis
You may be referred to a specialist such as a psychiatrist, psychologist, or other licensed mental health professional for care. Show Sources.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found