patch 9.1.1136: Match highlighting marks a buffer region as changed
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)
closes: #16697
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/drawscreen.c b/src/drawscreen.c
index a08cea3..4736bf1 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -3365,9 +3365,21 @@
win_T *wp,
linenr_T lnum)
{
- if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum)
- wp->w_redraw_top = lnum;
- if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < lnum)
- wp->w_redraw_bot = lnum;
- redraw_win_later(wp, UPD_VALID);
+ redraw_win_range_later(wp, lnum, lnum);
+}
+
+ void
+redraw_win_range_later(
+ win_T *wp,
+ linenr_T first,
+ linenr_T last)
+{
+ if (last >= wp->w_topline && first < wp->w_botline)
+ {
+ if (wp->w_redraw_top == 0 || wp->w_redraw_top > first)
+ wp->w_redraw_top = first;
+ if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < last)
+ wp->w_redraw_bot = last;
+ redraw_win_later(wp, UPD_VALID);
+ }
}