0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.1.2236: ml_get error if pattern matches beyond last line

Problem:    Ml_get error if pattern matches beyond last line.
Solution:   Adjust position if needed. (Christian Brabandt, closes #5139)
This commit is contained in:
Bram Moolenaar
2019-10-31 04:38:36 +01:00
parent 77ccc00340
commit bb26596242
3 changed files with 17 additions and 0 deletions

View File

@@ -3947,6 +3947,11 @@ do_sub(exarg_T *eap)
VIM_CLEAR(sub_firstline);
}
// Match might be after the last line for "\n\zs" matching at
// the end of the last line.
if (lnum > curbuf->b_ml.ml_line_count)
break;
if (sub_firstline == NULL)
{
sub_firstline = vim_strsave(ml_get(sub_firstlnum));