diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-05-17 00:22:06 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-05-17 00:22:06 +0200 |
commit | 965c04486c9364ded99b49c86f4c41228503df1f (patch) | |
tree | 7d3f8e427d7d6dc524d9339e46f67c267eabfba3 /src/textprop.c | |
parent | fc643e6016af80ed5be4570db5c26a6410f52d16 (diff) | |
download | vim-git-965c04486c9364ded99b49c86f4c41228503df1f.tar.gz |
patch 8.2.2863: removing a text property does not redraw optimallyv8.2.2863
Problem: Removing a text property does not redraw optimally.
Solution: Only redraw the lines that mithg actually have been changed.
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/textprop.c b/src/textprop.c index 9a9dddce7..bd9a77cad 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -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); } } |