comparison src/textprop.c @ 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 3f6a0ff1c5d3
children 8f2262c72178
comparison
equal deleted inserted replaced
24648:3105725aa7f2 24649:31a7fa6b2e93
813 f_prop_remove(typval_T *argvars, typval_T *rettv) 813 f_prop_remove(typval_T *argvars, typval_T *rettv)
814 { 814 {
815 linenr_T start = 1; 815 linenr_T start = 1;
816 linenr_T end = 0; 816 linenr_T end = 0;
817 linenr_T lnum; 817 linenr_T lnum;
818 linenr_T first_changed = 0;
819 linenr_T last_changed = 0;
818 dict_T *dict; 820 dict_T *dict;
819 buf_T *buf = curbuf; 821 buf_T *buf = curbuf;
820 int do_all; 822 int do_all;
821 int id = -1; 823 int id = -1;
822 int type_id = -1; 824 int type_id = -1;
923 mch_memmove(cur_prop, cur_prop + sizeof(textprop_T), 925 mch_memmove(cur_prop, cur_prop + sizeof(textprop_T),
924 taillen); 926 taillen);
925 buf->b_ml.ml_line_len -= sizeof(textprop_T); 927 buf->b_ml.ml_line_len -= sizeof(textprop_T);
926 --idx; 928 --idx;
927 929
930 if (first_changed == 0)
931 first_changed = lnum;
932 last_changed = lnum;
928 ++rettv->vval.v_number; 933 ++rettv->vval.v_number;
929 if (!do_all) 934 if (!do_all)
930 break; 935 break;
931 } 936 }
932 } 937 }
933 } 938 }
934 } 939 }
935 if (rettv->vval.v_number > 0) 940 if (first_changed > 0)
936 { 941 {
937 if (start == 1 && end == buf->b_ml.ml_line_count) 942 changed_lines_buf(buf, first_changed, last_changed + 1, 0);
938 redraw_buf_later(buf, NOT_VALID); 943 redraw_buf_later(buf, VALID);
939 else
940 {
941 changed_lines_buf(buf, start, end + 1, 0);
942 redraw_buf_later(buf, VALID);
943 }
944 } 944 }
945 } 945 }
946 946
947 /* 947 /*
948 * Common for f_prop_type_add() and f_prop_type_change(). 948 * Common for f_prop_type_add() and f_prop_type_change().