]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0437: MS-Windows: cursor flicker in vtp mode v9.2.0437
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Sun, 3 May 2026 18:37:05 +0000 (18:37 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 3 May 2026 18:37:05 +0000 (18:37 +0000)
Problem:  MS-Windows: cursor flicker in vtp mode
Solution: Skip mch_update_cursor() in cursor_visible() when vtp is
          active (Yasuhiro Matsumoto).

In vtp (ConPTY) mode the cursor visibility is controlled by DECTCEM
(\033[?25h / \033[?25l).  The follow-up call to mch_update_cursor() then
re-emits DECSCUSR (\033[0 q etc.) on every visibility toggle even though
the cursor shape did not change.  Some terminals briefly redisplay the
cursor when DECSCUSR arrives, so this can cause a visible flash at the
position the cursor will be moved to next (e.g. column 0 ahead of a line
redraw).

In non-vtp mode the call is still required because SetConsoleCursorInfo()
inside mch_set_cursor_shape() reads s_cursor_visible to apply the
visibility change, so keep that path unchanged.

closes: #20122

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 e8f8162f1b05e63ba5a7f2ec12dec7a12b679343..ab12d5a051be8d3595c05463a530879404289a98 100644 (file)
@@ -7104,9 +7104,19 @@ cursor_visible(BOOL fVisible)
     s_cursor_visible = fVisible;
 
     if (vtp_working)
+    {
+       // In vtp mode, visibility is controlled solely by DECTCEM.  Skip
+       // mch_update_cursor() since shape is independent of visibility and
+       // re-emitting DECSCUSR can cause the terminal to briefly redisplay
+       // the cursor while a redraw is in progress.
        vtp_printf("\033[?25%c", fVisible ? 'h' : 'l');
+       return;
+    }
 
 # ifdef MCH_CURSOR_SHAPE
+    // Non-vtp Windows console: SetConsoleCursorInfo() consults
+    // s_cursor_visible inside mch_set_cursor_shape(), so the call is needed
+    // to apply the new visibility.
     mch_update_cursor();
 # endif
 }
index f377ae58ee9681351fd92b65b4d2aa373d808e19..597842bf9c6a605a127fa5ee766854cd6a56aed6 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    437,
 /**/
     436,
 /**/