diff src/move.c @ 28224:c99005ffa8c3 v8.2.4638

patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline' Commit: https://github.com/vim/vim/commit/3e559cd88486ffab6b6fb4e0921b4600d137a617 Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Mar 27 19:26:55 2022 +0100 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline' Problem: Superfluous check if a redraw is needed for 'cursorline'. Solution: Remove check_redraw_cursorline(). (closes https://github.com/vim/vim/issues/10030, closes https://github.com/vim/vim/issues/10029)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Mar 2022 20:30:04 +0200
parents f04a3ec65e2d
children d83d9eaccdde
line wrap: on
line diff
--- a/src/move.c
+++ b/src/move.c
@@ -135,6 +135,26 @@ redraw_for_cursorline(win_T *wp)
     }
 }
 
+#ifdef FEAT_SYN_HL
+/*
+ * Redraw when w_virtcol changes and 'cursorcolumn' is set or 'cursorlineopt'
+ * contains "screenline".
+ */
+    static void
+redraw_for_cursorcolumn(win_T *wp)
+{
+    if ((wp->w_valid & VALID_VIRTCOL) == 0 && !pum_visible())
+    {
+	// When 'cursorcolumn' is set need to redraw with SOME_VALID.
+	if (wp->w_p_cuc)
+	    redraw_later(SOME_VALID);
+	// When 'cursorlineopt' contains "screenline" need to redraw with VALID.
+	else if (wp->w_p_cul && (wp->w_p_culopt_flags & CULOPT_SCRLINE))
+	    redraw_later(VALID);
+    }
+}
+#endif
+
 /*
  * Update curwin->w_topline and redraw if necessary.
  * Used to update the screen before printing a message.
@@ -798,11 +818,10 @@ validate_virtcol_win(win_T *wp)
     if (!(wp->w_valid & VALID_VIRTCOL))
     {
 	getvvcol(wp, &wp->w_cursor, NULL, &(wp->w_virtcol), NULL);
+#ifdef FEAT_SYN_HL
+	redraw_for_cursorcolumn(wp);
+#endif
 	wp->w_valid |= VALID_VIRTCOL;
-#ifdef FEAT_SYN_HL
-	if (wp->w_p_cuc && !pum_visible())
-	    redraw_win_later(wp, SOME_VALID);
-#endif
     }
 }
 
@@ -1169,10 +1188,7 @@ curs_columns(
 	redraw_later(NOT_VALID);
 
 #ifdef FEAT_SYN_HL
-    // Redraw when w_virtcol changes and 'cursorcolumn' is set
-    if (curwin->w_p_cuc && (curwin->w_valid & VALID_VIRTCOL) == 0
-	    && !pum_visible())
-	redraw_later(SOME_VALID);
+    redraw_for_cursorcolumn(curwin);
 #endif
 #if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)
     if (popup_is_popup(curwin) && curbuf->b_term != NULL)