diff src/main.c @ 18440:d6cb1e706fb7 v8.1.2214

patch 8.1.2214: too much is redrawn when 'cursorline' is set Commit: https://github.com/vim/vim/commit/11a58af66fa5c442f0a22c5d59beabf187ed4e89 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 24 22:32:31 2019 +0200 patch 8.1.2214: too much is redrawn when 'cursorline' is set Problem: Too much is redrawn when 'cursorline' is set. Solution: Don't do a complete redraw. (closes https://github.com/vim/vim/issues/5079)
author Bram Moolenaar <Bram@vim.org>
date Thu, 24 Oct 2019 22:45:04 +0200
parents 506bf60a30a0
children e93cab5d0f0f
line wrap: on
line diff
--- a/src/main.c
+++ b/src/main.c
@@ -1380,27 +1380,20 @@ main_loop(
 	    validate_cursor();
 
 #ifdef FEAT_SYN_HL
-	    if (curwin->w_p_cul && curwin->w_p_wrap
-				&& (curwin->w_p_culopt_flags & CULOPT_SCRLINE))
-		must_redraw = NOT_VALID;
+	    // Might need to update for 'cursorline'.
+	    // When 'cursorlineopt' is "screenline" need to redraw always.
+	    if (curwin->w_p_cul
+		    && (curwin->w_last_cursorline != curwin->w_cursor.lnum
+			|| (curwin->w_p_culopt_flags & CULOPT_SCRLINE))
+		    && !char_avail())
+		redraw_later(VALID);
 #endif
-
 	    if (VIsual_active)
 		update_curbuf(INVERTED); // update inverted part
 	    else if (must_redraw)
 	    {
 		mch_disable_flush();	// Stop issuing gui_mch_flush().
-#ifdef FEAT_SYN_HL
-		// Might need some more update for the cursorscreen line.
-		// TODO: can we optimize this?
-		if (curwin->w_p_cul
-			&& curwin->w_p_wrap
-			&& (curwin->w_p_culopt_flags & CULOPT_SCRLINE)
-			&& !char_avail())
-		    update_screen(VALID);
-		else
-#endif
-		    update_screen(0);
+		update_screen(0);
 		mch_enable_flush();
 	    }
 	    else if (redraw_cmdline || clear_cmdline)