]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0184: MS-Windows: screen flicker with termguicolors and visualbell v9.2.0184
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Mon, 16 Mar 2026 22:06:47 +0000 (22:06 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 16 Mar 2026 22:09:35 +0000 (22:09 +0000)
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 <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/os_win32.c
src/version.c

index 99acf6afed11a8fe186049c90a35f2a298630c0b..62fe2ffb7f546f180acc1c640d90ba9b0a9f695a 100644 (file)
@@ -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
index 60b86018f6123c8016fb8c8f59a324422f29d2fb..0bfaa8e7a507fa14e0ba1646e8bda66f7ced05c4 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    184,
 /**/
     183,
 /**/