]> granicus.if.org Git - vim/commitdiff
patch 8.2.2863: removing a text property does not redraw optimally v8.2.2863
authorBram Moolenaar <Bram@vim.org>
Sun, 16 May 2021 22:22:06 +0000 (00:22 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 16 May 2021 22:22:06 +0000 (00:22 +0200)
Problem:    Removing a text property does not redraw optimally.
Solution:   Only redraw the lines that mithg actually have been changed.

src/textprop.c
src/version.c

index 9a9dddce72000f3889eebf754298f7cb6fa786ca..bd9a77cada2d8e76c306bf33390cab749400505d 100644 (file)
@@ -815,6 +815,8 @@ f_prop_remove(typval_T *argvars, typval_T *rettv)
     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_T *rettv)
                    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_T *rettv)
            }
        }
     }
-    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);
     }
 }
 
index b5401e624662076898495756d1f92ec7fd445879..cf5208ffc810a9a5ee58bfa551c176f219fde489 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2863,
 /**/
     2862,
 /**/