diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-11-02 11:32:39 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-11-02 12:21:15 -0400 |
commit | 4a5adae95084e2dbaea59f0cffb9087ec4a6415e (patch) | |
tree | 936fd72ae937d215c45d20859a0683bb70477c9e /src/nvim/ex_cmds.c | |
parent | 63ab994fba2f2e0878be734d20bf8d106ddab67c (diff) | |
download | rneovim-4a5adae95084e2dbaea59f0cffb9087ec4a6415e.tar.gz rneovim-4a5adae95084e2dbaea59f0cffb9087ec4a6415e.tar.bz2 rneovim-4a5adae95084e2dbaea59f0cffb9087ec4a6415e.zip |
vim-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 )
https://github.com/vim/vim/commit/bb26596242fa7db477e2cd706dd99f9a426b5f71
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 2e8bd79c81..04aa8f7ef6 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -3524,6 +3524,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, // Note: If not first match on a line, column can't be known here current_match.start.lnum = sub_firstlnum; + // 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)); } |