changeset 24649:31a7fa6b2e93 v8.2.2863

patch 8.2.2863: removing a text property does not redraw optimally Commit: https://github.com/vim/vim/commit/965c04486c9364ded99b49c86f4c41228503df1f Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 17 00:22:06 2021 +0200 patch 8.2.2863: removing a text property does not redraw optimally Problem: Removing a text property does not redraw optimally. Solution: Only redraw the lines that mithg actually have been changed.
author Bram Moolenaar <Bram@vim.org>
date Mon, 17 May 2021 00:30:04 +0200
parents 3105725aa7f2
children 55d8908b5756
files src/textprop.c src/version.c
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -815,6 +815,8 @@ f_prop_remove(typval_T *argvars, typval_
     linenr_T	start = 1;
     linenr_T	end = 0;
     linenr_T	lnum;
+    linenr_T	first_changed = 0;
+    linenr_T	last_changed = 0;
     dict_T	*dict;
     buf_T	*buf = curbuf;
     int		do_all;
@@ -925,6 +927,9 @@ f_prop_remove(typval_T *argvars, typval_
 		    buf->b_ml.ml_line_len -= sizeof(textprop_T);
 		    --idx;
 
+		    if (first_changed == 0)
+			first_changed = lnum;
+		    last_changed = lnum;
 		    ++rettv->vval.v_number;
 		    if (!do_all)
 			break;
@@ -932,15 +937,10 @@ f_prop_remove(typval_T *argvars, typval_
 	    }
 	}
     }
-    if (rettv->vval.v_number > 0)
+    if (first_changed > 0)
     {
-	if (start == 1 && end == buf->b_ml.ml_line_count)
-	    redraw_buf_later(buf, NOT_VALID);
-	else
-	{
-	    changed_lines_buf(buf, start, end + 1, 0);
-	    redraw_buf_later(buf, VALID);
-	}
+	changed_lines_buf(buf, first_changed, last_changed + 1, 0);
+	redraw_buf_later(buf, VALID);
     }
 }
 
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2863,
+/**/
     2862,
 /**/
     2861,