aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Czaplinski <czapkofan@gmail.com>2016-07-02 18:11:25 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-07-02 20:32:58 -0400
commitc5b02d5a7a0a19b338ff2cbf610210058eac0a10 (patch)
treed2e638b52353a3c14759090acc077f543a817387
parentf80eb768c75de2065626203de001738e1dda436e (diff)
downloadrneovim-c5b02d5a7a0a19b338ff2cbf610210058eac0a10.tar.gz
rneovim-c5b02d5a7a0a19b338ff2cbf610210058eac0a10.tar.bz2
rneovim-c5b02d5a7a0a19b338ff2cbf610210058eac0a10.zip
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.
-rw-r--r--src/nvim/tui/tui.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 50558e644a..ea10130056 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -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);