patch 9.2.0184: MS-Windows: screen flicker with termguicolors and visualbell

Commit: 
https://github.com/vim/vim/commit/74c53196cc108cf744a3f9a6a568bf8c3d75294a
Author: Yasuhiro Matsumoto <[email protected]>
Date:   Mon Mar 16 22:06:47 2026 +0000

    patch 9.2.0184: MS-Windows: screen flicker with termguicolors and visualbell
    
    Problem:  When 'termguicolors' is used on MS-Windows (VTP mode), sending
              CSI query sequences (like DECRQM) causes the console to
              generate responses that are misinterpreted as keystrokes.
              The leading ESC triggers a beep or 'visualbell' flash.
    Solution: In mch_write(), discard CSI sequences when USE_VTP is active
              so the console does not process queries and generate unwanted
              input responses (Yasuhiro Matsumoto).
    
    related: #11532
    closes:  #19694
    
    Signed-off-by: Yasuhiro Matsumoto <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/os_win32.c b/src/os_win32.c
index 99acf6afe..62fe2ffb7 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -7440,17 +7440,22 @@ notsgr:
        }
        else if (s[0] == ESC && len >= 3-1 && s[1] == '[')
        {
-           int l = 2;
-
-           if (SAFE_isdigit(s[l]))
-               l++;
-           if (s[l] == ' ' && s[l + 1] == 'q')
+           // When USE_VTP is active, CSI sequences written through
+           // write_chars() are interpreted by the console's VTP parser,
+           // generating responses (e.g. DECRQM) that end up in the
+           // input buffer as unwanted keystrokes.  Discard them.
+           if (USE_VTP)
            {
-               // DECSCUSR (cursor style) sequences
-               if (vtp_working)
-                   vtp_printf("%.*s", l + 2, s);   // Pass through
-               s += l + 2;
-               len -= l + 1;
+               int l = 2;
+
+               // skip parameter and intermediate bytes (0x20-0x3F)
+               while (s + l < end && s[l] >= 0x20 && s[l] <= 0x3F)
+                   l++;
+               // skip the final byte (0x40-0x7E)
+               if (s + l < end && s[l] >= 0x40 && s[l] <= 0x7E)
+                   l++;
+               len -= l - 1;
+               s += l;
            }
        }
        else
diff --git a/src/version.c b/src/version.c
index 60b86018f..0bfaa8e7a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    184,
 /**/
     183,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1w2GDI-008xVO-RN%40256bit.org.

Raspunde prin e-mail lui