diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-31 04:38:36 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-31 04:38:36 +0100 |
commit | bb26596242fa7db477e2cd706dd99f9a426b5f71 (patch) | |
tree | a8d1d09b9bbf5d729b0ce6406963038dee2055a8 /src/ex_cmds.c | |
parent | 77ccc00340ed2598f7aa09716217e878665964fa (diff) |
patch 8.1.2236: ml_get error if pattern matches beyond last linev8.1.2236
Problem: Ml_get error if pattern matches beyond last line.
Solution: Adjust position if needed. (Christian Brabandt, closes #5139)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index fc692e3235..a7f80a80a8 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -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)); |