inccommand: fix optimization logic #7224

Before this change the preview changes in the buffer viewport were
limited to the size of the preview window ('cmdwinheight').

closes #7220
This commit is contained in:
KillTheMule
2017-08-28 21:33:31 +02:00
committed by Justin M. Keyes
parent 06f8ad5b2a
commit 26d08dfd0d
2 changed files with 29 additions and 2 deletions

View File

@@ -3332,10 +3332,12 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout)
sub = regtilde(sub, p_magic);
// Check for a match on each line.
// If preview: limit to max('cmdwinheight', viewport).
linenr_T line2 = eap->line2;
for (linenr_T lnum = eap->line1;
lnum <= line2 && !(got_quit || aborting())
&& (!preview || matched_lines.size <= (size_t)p_cwh);
lnum <= line2 && !got_quit && !aborting()
&& (!preview || matched_lines.size < (size_t)p_cwh
|| lnum <= curwin->w_botline);
lnum++) {
long nmatch = vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
(colnr_T)0, NULL);