]> granicus.if.org Git - vim/commitdiff
patch 8.2.0646: t_Co uses the value of $COLORS in the GUI v8.2.0646
authorBram Moolenaar <Bram@vim.org>
Sun, 26 Apr 2020 14:52:49 +0000 (16:52 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 26 Apr 2020 14:52:49 +0000 (16:52 +0200)
Problem:    t_Co uses the value of $COLORS in the GUI. (Masato Nishihata)
Solution:   Ignore $COLORS for the GUI. (closes #5992)

src/os_unix.c
src/term.c
src/version.c

index c6d386b92923231eb3c51f66191d3b929019c485..66903e081902f065168fe4df6c5b556ded5cd05f 100644 (file)
@@ -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)
index ef91b8fac50455cfebfc611bd47e37cf37e0c0d8..f5d5dbc6f7b70ca67345d125c12298228739dfba 100644 (file)
@@ -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);
+       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);
+           if (colors != t_colors)
+               set_color_count(colors);
+       }
     }
 }
 
index 392ac1893260e328194648c58d6b180cc628ac86..16145f2d67b4f82d97632a04808344c36643d6ea 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    646,
 /**/
     645,
 /**/