aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/match.c
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2025-02-23 09:35:26 +0100
committerGitHub <noreply@github.com>2025-02-23 16:35:26 +0800
commit5a41f7e69c77e70f8dcd55a4e15beb9941d00855 (patch)
treeeb86bf2ee1534424b1e5ba69d97ceeb163ed50a2 /src/nvim/match.c
parent1c8173487104f905482b1d5a327defadf2c64573 (diff)
downloadrneovim-5a41f7e69c77e70f8dcd55a4e15beb9941d00855.tar.gz
rneovim-5a41f7e69c77e70f8dcd55a4e15beb9941d00855.tar.bz2
rneovim-5a41f7e69c77e70f8dcd55a4e15beb9941d00855.zip
vim-patch:9.1.1136: Match highlighting marks a buffer region as changed (#32561)
Problem: Match highlighting marks a buffer region to be redrawn as if its buffer text was changed, unnecessarily invoking syntax code. Solution: Set the `w_redraw_top/bot` variables instead of the b_mod_* ones (Luuk van Baal) https://github.com/vim/vim/commit/7bbb0f357e9f9d3a737dac75e4b5ba7dfbf3ecc1
Diffstat (limited to 'src/nvim/match.c')
-rw-r--r--src/nvim/match.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/nvim/match.c b/src/nvim/match.c
index 86cab5221d..a1126fbbcd 100644
--- a/src/nvim/match.c
+++ b/src/nvim/match.c
@@ -190,19 +190,7 @@ static int match_add(win_T *wp, const char *const grp, const char *const pat, in
// Calculate top and bottom lines for redrawing area
if (toplnum != 0) {
- if (wp->w_buffer->b_mod_set) {
- if (wp->w_buffer->b_mod_top > toplnum) {
- wp->w_buffer->b_mod_top = toplnum;
- }
- if (wp->w_buffer->b_mod_bot < botlnum) {
- wp->w_buffer->b_mod_bot = botlnum;
- }
- } else {
- wp->w_buffer->b_mod_set = true;
- wp->w_buffer->b_mod_top = toplnum;
- wp->w_buffer->b_mod_bot = botlnum;
- wp->w_buffer->b_mod_xlines = 0;
- }
+ redraw_win_range_later(wp, toplnum, botlnum);
m->mit_toplnum = toplnum;
m->mit_botlnum = botlnum;
rtype = UPD_VALID;
@@ -268,19 +256,7 @@ static int match_delete(win_T *wp, int id, bool perr)
vim_regfree(cur->mit_match.regprog);
xfree(cur->mit_pattern);
if (cur->mit_toplnum != 0) {
- if (wp->w_buffer->b_mod_set) {
- if (wp->w_buffer->b_mod_top > cur->mit_toplnum) {
- wp->w_buffer->b_mod_top = cur->mit_toplnum;
- }
- if (wp->w_buffer->b_mod_bot < cur->mit_botlnum) {
- wp->w_buffer->b_mod_bot = cur->mit_botlnum;
- }
- } else {
- wp->w_buffer->b_mod_set = true;
- wp->w_buffer->b_mod_top = cur->mit_toplnum;
- wp->w_buffer->b_mod_bot = cur->mit_botlnum;
- wp->w_buffer->b_mod_xlines = 0;
- }
+ redraw_win_range_later(wp, cur->mit_toplnum, cur->mit_botlnum);
rtype = UPD_VALID;
}
xfree(cur->mit_pos_array);