The underlying problem is that the mapping done by
screen between the actual terminal (identified by the
TERM environment variable outside
screen) and the emulation within
screen is incomplete.
If you happen to test it (using vttest or tack), you may notice deficiencies for
Attempting to fix these problems by setting
.screenrc has the drawback that it works only for a given actual-terminal, and is not portable to other terminal implementations. The documentation notes
The use of the term command is discouraged for non-default purpose.
There is another solution (with a different drawback), using this feature from
When screen tries to figure out a terminal name for itself, it first looks for an entry named screen.term, where term is the contents of your
$TERM variable. If no such entry exists, screen tries
screen-w, if the terminal is wide (132 cols or more)). If even this entry cannot be found,
vt100 is used as a substitute.
ncurses provides several useful alternate terminal descriptions for this case, e.g., screen.xterm-new, to repair problems in screen's mapping.
In practice, I use
TERM=xterm-new, and when running screen, get a usable mapping of function keys.
Referring back to screen's
term setting, in testing you may notice that there are still problems with the mapping, which are addressed in these alternatives. If it were possible to get an accurate terminal description using
term, these alternatives would be simple aliases to
screen. They are not.
ncurses does not provide
screen.xterm (sic) because:
TERM=xterm is misused widely for terminal emulators which differ from xterm; adding this mapping would only aggravate that situation (see for example Why not just use TERM set to "xterm"? in the ncurses FAQ)
- the alternative name
screen.xterm is less likely to be installed on remote systems (see change comment from June 2015 in the terminal database).
On the whole, however, using the alternate names is an improvement over using
term in your
.screenrc: it solves more problems than it creates. The reverse is true of the