patch 9.2.0206: MS-Window: stripping all CSI sequences

Commit: 
https://github.com/vim/vim/commit/f445ed0d56389d6f2ace5af9df73a3b8070e87a4
Author: Yasuhiro Matsumoto <[email protected]>
Date:   Thu Mar 19 21:31:34 2026 +0000

    patch 9.2.0206: MS-Window: stripping all CSI sequences
    
    Problem:  MS-Window: stripping all CSI sequences
              (Ke Mao, after v9.2.0184)
    Solution: Restore vtp_printf() to pass-through DECSUSR codes
              (Yasuhiro Matsumoto).
    
    Patch 9.2.0184 discards all CSI sequences in mch_write() when VTP is
    active to prevent unwanted DECRQM responses.  However, this also
    removed the existing DECSCUSR pass-through, breaking cursor shape
    changes (t_SI/t_SR/t_EI) on Windows Terminal.
    
    Restore vtp_printf() pass-through for DECSCUSR (final byte 'q') while
    continuing to discard other CSI sequences.
    
    related: #19694
    related: #11532
    fixes:   #19750
    closes:  #19755
    
    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 62fe2ffb7..0174068f0 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -7443,7 +7443,9 @@ notsgr:
            // 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.
+           // input buffer as unwanted keystrokes.  Parse the sequence
+           // and only pass through known safe ones (e.g. DECSCUSR for
+           // cursor shape), discard the rest.
            if (USE_VTP)
            {
                int l = 2;
@@ -7453,7 +7455,12 @@ notsgr:
                    l++;
                // skip the final byte (0x40-0x7E)
                if (s + l < end && s[l] >= 0x40 && s[l] <= 0x7E)
+               {
+                   // DECSCUSR (cursor style): pass through to terminal
+                   if (s[l] == 'q')
+                       vtp_printf("%.*s", l + 1, s);
                    l++;
+               }
                len -= l - 1;
                s += l;
            }
diff --git a/src/version.c b/src/version.c
index 439cfd26b..6914a9b5d 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 */
+/**/
+    206,
 /**/
     205,
 /**/

-- 
-- 
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/E1w3LAt-00DigZ-UT%40256bit.org.

Raspunde prin e-mail lui