Skip to content

Commit

Permalink
patch 8.2.2863: removing a text property does not redraw optimally
Browse files Browse the repository at this point in the history
Problem:    Removing a text property does not redraw optimally.
Solution:   Only redraw the lines that mithg actually have been changed.
  • Loading branch information
brammool committed May 16, 2021
1 parent fc643e6 commit 965c044
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/textprop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -925,22 +927,20 @@ 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;
}
}
}
}
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);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2863,
/**/
2862,
/**/
Expand Down

0 comments on commit 965c044

Please sign in to comment.