options: Set 't_Co' from unibilium + fix_terminfo.

Closes #3428
References #4999

The Linux "virtual consoles" available on Alt-F1...Alt-F7 (i.e.
tty1-tty7) support only 8 colors (actually, it's 16 colors when counted
together with "bold/bright" attribute) and 8 background colors (those in
some cases can be upped to 16 too, by using "blink" attribute - but this
might be more risky, in case some legacy consoles really show it as
blinking? I'm not sure about that.) This limit is buried deep in kernel
sources for default tty drivers. Trying to use the Neovim's default 256
colors in this case gives totally bad colors, breaking all color schemes
and sometimes rendering parts of the text invisible. A simple change
enables code paths for handling 8/16 colors, which are still present in
Neovim codebase.
This commit is contained in:
Mateusz Czaplinski 2016-07-02 18:11:25 -04:00 committed by Justin M. Keyes
parent f80eb768c7
commit c5b02d5a7a

View File

@ -135,6 +135,8 @@ static void terminfo_start(UI *ui)
data->ut = unibi_dummy();
}
fix_terminfo(data);
// Set 't_Co' from the result of unibilium & fix_terminfo.
t_colors = unibi_get_num(data->ut, unibi_max_colors);
// Enter alternate screen and clear
unibi_out(ui, unibi_enter_ca_mode);
unibi_out(ui, unibi_clear_screen);