diff options
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 712ce711d0..1b6d9b50e9 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)); } @@ -5583,7 +5588,7 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr, col_width = log10(highest_num_line) + 1 + 3; } } else { - // if we fail to split the window, we don't want to modify the preview buffer + // Failed to split the window, don't show 'inccommand' preview. preview_buf = NULL; } |