vt100-parser
vt100-parser copied to clipboard
Should the parser save current screen content to history before executing "Erase the screen"?
When I checked the output, I found some content are lost, and the number of lost lines is related to Height
parameter.
If I set height to 1, e.g. -g 1000x1
, it would not lost anything.
After some debugging, I found it is due to two ESC Sequences: <ESC>[H<ESC>[2J
.
<ESC>[H
will move the cursor to row 0, column 0, and <ESC>[2J
will erase the screen.
The two sequences appears serval times in my typescript file, so output will lost Height - 1
lines when parser meet them each time.
Thanks for pointing this out!
The standard only says that <ESC>[2J
erases the visible screen. xterm does this by simply erasing all the text in the display buffer, so it is not saved to history. VTE (gnome-terminal, xfce-terminal, etc), tmux, and screen instead implement this by scrolling up, so that the display buffer is saved to history. Since the standard does not say anything about the history, both are valid. (To test, use ./rawcat test/t0056-ED.in
.)
vt100.py currently has xterm compatibility. I'd be open to having an option to switch between them and think it would be interesting to document the differences, but I can't promise that I'll have time to get to that.