changeset 20181:0ab9d7469ce7 v8.2.0646

patch 8.2.0646: t_Co uses the value of $COLORS in the GUI Commit: https://github.com/vim/vim/commit/759d81549c1340185f0d92524c563bb37697ea88 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 26 16:52:49 2020 +0200 patch 8.2.0646: t_Co uses the value of $COLORS in the GUI Problem: t_Co uses the value of $COLORS in the GUI. (Masato Nishihata) Solution: Ignore $COLORS for the GUI. (closes https://github.com/vim/vim/issues/5992)
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Apr 2020 17:00:03 +0200
parents 6ac0d289f8e7
children c07406a4d7f1
files src/os_unix.c src/term.c src/version.c
diffstat 3 files changed, 16 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4160,11 +4160,6 @@ set_child_environment(
     static char	envbuf_Servername[60];
 #  endif
 # endif
-    long	colors =
-#  ifdef FEAT_GUI
-	    gui.in_use ? 256*256*256 :
-#  endif
-	    t_colors;
 
 # ifdef HAVE_SETENV
     setenv("TERM", term, 1);
@@ -4174,7 +4169,7 @@ set_child_environment(
     setenv("LINES", (char *)envbuf, 1);
     sprintf((char *)envbuf, "%ld", columns);
     setenv("COLUMNS", (char *)envbuf, 1);
-    sprintf((char *)envbuf, "%ld", colors);
+    sprintf((char *)envbuf, "%d", t_colors);
     setenv("COLORS", (char *)envbuf, 1);
 #  ifdef FEAT_TERMINAL
     if (is_terminal)
--- a/src/term.c
+++ b/src/term.c
@@ -3122,15 +3122,21 @@ ttest(int pairs)
     }
     need_gather = TRUE;
 
-    // Set t_colors to the value of $COLORS or t_Co.
+    // Set t_colors to the value of $COLORS or t_Co.  Ignore $COLORS in the
+    // GUI.
     t_colors = atoi((char *)T_CCO);
-    env_colors = mch_getenv((char_u *)"COLORS");
-    if (env_colors != NULL && isdigit(*env_colors))
+#ifdef FEAT_GUI
+    if (!gui.in_use)
+#endif
     {
-	int colors = atoi((char *)env_colors);
-
-	if (colors != t_colors)
-	    set_color_count(colors);
+	env_colors = mch_getenv((char_u *)"COLORS");
+	if (env_colors != NULL && isdigit(*env_colors))
+	{
+	    int colors = atoi((char *)env_colors);
+
+	    if (colors != t_colors)
+		set_color_count(colors);
+	}
     }
 }
 
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    646,
+/**/
     645,
 /**/
     644,