patch 9.1.1027: no sanitize check when running linematch
Problem: no sanitize check when running linematch
Solution: add sanitize check before applying the linematch algorithm,
similar to diff_find_change() (Jonathon)
closes: #16446
Signed-off-by: Jonathon <jonathonwhite@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/diff.c b/src/diff.c
index c348894..41d61b1 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -2351,7 +2351,8 @@
// Don't run linematch when lnum is offscreen. Useful for scrollbind
// calculations which need to count all the filler lines above the screen.
if (lnum >= wp->w_topline && lnum < wp->w_botline
- && !dp->is_linematched && diff_linematch(dp))
+ && !dp->is_linematched && diff_linematch(dp)
+ && diff_check_sanity(curtab, dp))
run_linematch_algorithm(dp);
if (dp->is_linematched)