comparison src/ex_docmd.c @ 25911:d6d31972c76d v8.2.3489

patch 8.2.3489: ml_get error after search with range Commit: https://github.com/vim/vim/commit/35a319b77f897744eec1155b736e9372c9c5575f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 9 13:58:55 2021 +0100 patch 8.2.3489: ml_get error after search with range Problem: ml_get error after search with range. Solution: Limit the line number to the buffer line count.
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Oct 2021 15:00:03 +0200
parents 826c36b4640b
children 377a7686a52f
comparison
equal deleted inserted replaced
25910:d95774ab4307 25911:d6d31972c76d
4227 4227
4228 pos = curwin->w_cursor; // save curwin->w_cursor 4228 pos = curwin->w_cursor; // save curwin->w_cursor
4229 4229
4230 // When '/' or '?' follows another address, start from 4230 // When '/' or '?' follows another address, start from
4231 // there. 4231 // there.
4232 if (lnum != MAXLNUM) 4232 if (lnum > 0 && lnum != MAXLNUM)
4233 curwin->w_cursor.lnum = lnum; 4233 curwin->w_cursor.lnum =
4234 lnum > curbuf->b_ml.ml_line_count
4235 ? curbuf->b_ml.ml_line_count : lnum;
4234 4236
4235 // Start a forward search at the end of the line (unless 4237 // Start a forward search at the end of the line (unless
4236 // before the first line). 4238 // before the first line).
4237 // Start a backward search at the start of the line. 4239 // Start a backward search at the start of the line.
4238 // This makes sure we never match in the current 4240 // This makes sure we never match in the current