-
Notifications
You must be signed in to change notification settings - Fork 765
Description
The current situation is that mosh
will manually test for color support using terminfo, which makes sense, but then it only checks to see if the value is 256 or not. If it's 256, it sets xterm-256color
and if not, it sets xterm
:
mosh/src/frontend/mosh-server.cc
Lines 572 to 578 in 1105d48
const char default_term[] = "xterm"; | |
const char color_term[] = "xterm-256color"; | |
if ( setenv( "TERM", ( colors == 256 ) ? color_term : default_term, true ) < 0 ) { | |
perror( "setenv" ); | |
exit( 1 ); | |
} |
This is a problem when terminals support truecolor and correctly advertise that they support 16M colors via terminfo, e.g.
$ tput -T alacritty-direct colors
16777216
In this scenario, mosh
says, "Well.. it's not 256 so I guess it's 8," and then sets TERM=xterm
. Then everything that is run inside the session, including tmux
, thinks that not even 256 colors are supported, let alone 16M colors. It would be great if COLORTERM=truecolor
were sufficient, but unfortunately it's not. There are too many applications that only look at $TERM
(via terminfo) and are thus broken :(.