DECSTR handling corrupts screen
See original GitHub issueIt seems that although the default behaviour for DECSTR is to reset cursor position, other terminals (xterm, macOS terminal, gnome-terminal) don’t do this. In particular, GNU screen issues DECSTR before going into alternate screen mode, and after returning from it, the cursor ends up in 0;0, writing over old screen contents. Here’s an output dump from an actual GNU screen in-and-out (JS string, can be fed straight into xterm):
" root@gpu-box:~# screen -x\r\n\u001b[!p\u001b[?3;4l\u001b[4l\u001b>\u001b[?1049h\u001b[22;0;0t\u001b[4l\u001b[?1h\u001b=\u001b[0m\u001b(B\u001b[1;40r\u001b[H\u001b[2J\u001b[H\u001b[2Jroot@gpu-box:~#\r\nroot@gpu-box:~# l\r\n1.py \u001b[1m\u001b[35mkitten.jpg\u001b[2C\u001b[34mNVIDIA_CUDA-10.1_Samples\u001b[0m/\r\nroot@gpu-box:~# \r\u001b[36B\u001b[7mReally kill this window [y/n]\u001b[27m\u001b[K\r \u001b[4;20H\u001b[?1l\u001b>\u001b[40;1H\r\n\u001b[?1049l[screen is terminating]\r\nroot@gpu-box:~# "
Here’s a simple repro:
"one \u001b[!p \u001b[?1049h \u001b[?1049l two"
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
@Eugeny Should be fixed in #2746.
Oh well, seems the docs were interpreted wrong in this regard. Looking at DEC STD 070 it clearly states:
Regarding the cursor DECOM and DECSC are reset, I guess DECSC got misinterpreted as resetting the active cursor position. But it should only reset the values stored in the cursor save structure to the home position (thus a following DECRC would move the cursor to home).