diff options
Diffstat (limited to 'src/regexp.c')
-rw-r--r-- | src/regexp.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; } |