]> granicus.if.org Git - vim/commitdiff
patch 9.0.1235: MS-Windows console: not flushing termguicolors v9.0.1235
authorChristopher Plewright <chris@createng.com>
Mon, 23 Jan 2023 12:33:23 +0000 (12:33 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 23 Jan 2023 12:33:23 +0000 (12:33 +0000)
Problem:    MS-Windows console: not flushing termguicolors.
Solution:   Flush termguicolors. (Christopher Plewright, closes #11871)

src/os_win32.c
src/proto/os_win32.pro
src/term.c
src/version.c

index ba5d228b840ad0be5ce55a632dd7987ee340dc01..e80533b017e79689c3ebc1c5b6f27822df85251c 100644 (file)
@@ -6776,20 +6776,30 @@ visual_bell(void)
     WORD    attrFlash = ~g_attrCurrent & 0xff;
 
     DWORD   dwDummy;
-    LPWORD  oldattrs = ALLOC_MULT(WORD, Rows * Columns);
+    LPWORD  oldattrs = NULL;
 
-    if (oldattrs == NULL)
-       return;
-    ReadConsoleOutputAttribute(g_hConOut, oldattrs, Rows * Columns,
+# ifdef FEAT_TERMGUICOLORS
+    if (!(p_tgc || t_colors >= 256))
+# endif
+    {
+       oldattrs = ALLOC_MULT(WORD, Rows * Columns);
+       if (oldattrs == NULL)
+           return;
+       ReadConsoleOutputAttribute(g_hConOut, oldattrs, Rows * Columns,
                               coordOrigin, &dwDummy);
+    }
+
     FillConsoleOutputAttribute(g_hConOut, attrFlash, Rows * Columns,
                               coordOrigin, &dwDummy);
 
     Sleep(15);     // wait for 15 msec
-    if (!vtp_working)
+
+    if (oldattrs != NULL)
+    {
        WriteConsoleOutputAttribute(g_hConOut, oldattrs, Rows * Columns,
                                coordOrigin, &dwDummy);
-    vim_free(oldattrs);
+       vim_free(oldattrs);
+    }
 }
 
 
@@ -8665,12 +8675,6 @@ wt_init(void)
     wt_working = mch_getenv("WT_SESSION") != NULL;
 }
 
-    int
-use_wt(void)
-{
-    return USE_WT;
-}
-
 # ifdef FEAT_TERMGUICOLORS
     static int
 ctermtoxterm(
index 6673c7878d8562ba7413e8f732f16cf14aae8ddb..9f8b9695838dbb6f79adf48cb00a962b88cc2d8f 100644 (file)
@@ -73,7 +73,6 @@ void set_alist_count(void);
 void fix_arg_enc(void);
 int mch_setenv(char *var, char *value, int x);
 int vtp_printf(char *format, ...);
-int use_wt(void);
 void get_default_console_color(int *cterm_fg, int *cterm_bg, guicolor_T *gui_fg, guicolor_T *gui_bg);
 void control_console_color_rgb(void);
 int use_vtp(void);
index 54da3d7f8e19e10d321e5a9e315e7a8aad9d3976..042b6a681934f54f9a775de2dafb61d0f4017ae1 100644 (file)
@@ -3222,7 +3222,7 @@ term_rgb_color(char_u *s, guicolor_T rgb)
     vim_snprintf(buf, MAX_COLOR_STR_LEN,
                                  (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb));
 #ifdef FEAT_VTP
-    if (use_wt())
+    if (use_vtp() && (p_tgc || t_colors >= 256))
     {
        out_flush();
        buf[1] = '[';
index 831b64373920e5d3c3cbd6414ffc26fc5e962572..3e853b309353b9ce6b2067ec59774c08d1d5ca38 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1235,
 /**/
     1234,
 /**/