The explanation (and suggested equivalents) for the xterm initialization string aren't completely accurate.
Starting with the string from xterm's terminal description:
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).
DECSTR resets several things not found in the replacement:
- the cursor shape and appearance
- character sets
- other keyboard modes related to application/normal modes (
- 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
Removing the spurious clear-screen, the relevant portion of screen's customization is
so what was left out was (aside from
\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.