diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-07-22 20:33:05 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-07-22 20:33:05 +0200 |
commit | b7a8dfeb49784145fe133496ce38703d236e4fbe (patch) | |
tree | f977848f29234d713c554fb2a184ee0b91be949d /src/os_unix.c | |
parent | e173fd09720a346fbaa340003d31a4329283a805 (diff) | |
download | vim-git-b7a8dfeb49784145fe133496ce38703d236e4fbe.tar.gz |
patch 8.0.0748: running Vim in terminal window doesn't use the right colorsv8.0.0748
Problem: When running Vim in a terminal window it does not detect the right
number of colors available.
Solution: Detect the version string that libvterm returns. Pass the number
of colors in $COLORS.
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index bbc74c7f7..4caf38bb4 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4063,7 +4063,13 @@ set_child_environment(long rows, long columns, char *term) static char envbuf_Rows[20]; static char envbuf_Lines[20]; static char envbuf_Columns[20]; + static char envbuf_Colors[20]; # endif + long colors = +# ifdef FEAT_GUI + gui.in_use ? 256*256*256 : +# endif + t_colors; /* Simulate to have a dumb terminal (for now) */ # ifdef HAVE_SETENV @@ -4074,6 +4080,8 @@ set_child_environment(long rows, long columns, char *term) setenv("LINES", (char *)envbuf, 1); sprintf((char *)envbuf, "%ld", columns); setenv("COLUMNS", (char *)envbuf, 1); + sprintf((char *)envbuf, "%ld", colors); + setenv("COLORS", (char *)envbuf, 1); # else /* * Putenv does not copy the string, it has to remain valid. @@ -4088,6 +4096,8 @@ set_child_environment(long rows, long columns, char *term) vim_snprintf(envbuf_Columns, sizeof(envbuf_Columns), "COLUMNS=%ld", columns); putenv(envbuf_Columns); + vim_snprintf(envbuf_Colors, sizeof(envbuf_Colors), "COLORS=%ld", colors); + putenv(envbuf_Colors); # endif } |