The explanation (and suggested equivalents) for the xterm initialization string aren't completely accurate.
Starting with the string from xterm's terminal description:
is2=\E[!p\E[?3;4l\E[4l\E>
we have
CSI ! p Soft terminal reset (DECSTR).
CSI ? Pm l
DEC Private Mode Reset (DECRST).
...
Ps = 3 -> 80 Column Mode (DECCOLM).
Ps = 4 -> Jump (Fast) Scroll (DECSCLM).
CSI Pm l Reset Mode (RM).
...
Ps = 4 -> Replace Mode (IRM).
ESC > Normal Keypad (DECKPNM).
But DECSTR
resets several things not found in the replacement:
- the cursor shape and appearance
- character sets
- other keyboard modes related to application/normal modes (
DECCKM
, KAM
, DECKPAM
)
- wraparound (and reverse wraparound)
- origin mode
Also, it doesn't clear the screen.
The reason for using DECSTR
(since 1997) is to keep termcap sizes small enough to fit in termcap's 1024-byte limit.
The setting for screen
is from the Debian package; the bug report mentioned in the comment is Debian #134198 —
screen: has some sort of odd emulation problem most noticable with irssi and konsole, from 2002. screen
does not recognize that sequence, and incidentally, KDE konsole does not implement that sequence, as seen in KDE #134892, while at the same time its developers state in KDE #145977 that they prefer to not use a different TERM
value than xterm
. Since some users might want a terminal description which does match konsole's capabilities, that's in ncurses as konsole
, e.g.,
is2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8
versus
is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
Removing the spurious clear-screen, the relevant portion of screen's customization is
is2=\E[r\E[m\E[?7h\E[?1;4;6l
so what was left out was (aside from DECCOLM
) \E[4l
.
The \E7
and \E8
in the initialization string save/restore the cursor position when adjusting the scrolling margins. Just like the insert-mode, some users would notice the absence of the feature.
The point of the customization is to suppress the DECCOLM
(80/132 column) switching, and working from screen's cut-down and rather old customization might not work as well as adapting from a terminal description written for the terminal.
Further reading:
Would you mind decoding the termcapinfo line? – Huckle – 2015-09-30T17:23:41.727
2@Huckle: I added an explanation of the escape codes. – Paused until further notice. – 2015-09-30T18:12:41.840
thanks! added this answer to http://serverfault.com/questions/158508/terminal-width-issues-with-linux-screen/499008#499008
– Joshua D'Alton – 2013-04-13T08:06:45.807