From 6af24b2457752c0d36aaf9f29f03d39afd09937f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 09:39:57 +0200 Subject: Merging upstream version 2:9.1.0199. Signed-off-by: Daniel Baumann --- src/regexp.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/regexp.c') diff --git a/src/regexp.c b/src/regexp.c index c3bc496..4373ae0 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -1318,6 +1318,9 @@ reg_match_visual(void) top = curbuf->b_visual.vi_end; bot = curbuf->b_visual.vi_start; } + // a substitute command may have removed some lines + if (bot.lnum > curbuf->b_ml.ml_line_count) + bot.lnum = curbuf->b_ml.ml_line_count; mode = curbuf->b_visual.vi_mode; curswant = curbuf->b_visual.vi_curswant; } -- cgit v1.2.3