summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-03-07 22:38:47 +0000
committerBram Moolenaar <Bram@vim.org>2006-03-07 22:38:47 +0000
commit1f35bf9cab16d3f3a63c47894c69c9aa699d8145 (patch)
tree6484c3e7edc2bcc857cb509b18c5d52d4977db59 /src/quickfix.c
parenta203182302733c0ea98d66ee1f576f251697dc81 (diff)
downloadvim-git-1f35bf9cab16d3f3a63c47894c69c9aa699d8145.tar.gz
updated for version 7.0217v7.0217
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index bc4ef1c6a..1431c76a4 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2905,6 +2905,7 @@ ex_vimgrep(eap)
char_u *au_name = NULL;
int flags = 0;
colnr_T col;
+ long tomatch;
switch (eap->cmdidx)
{
@@ -2933,6 +2934,11 @@ ex_vimgrep(eap)
return;
}
+ if (eap->addr_count > 0)
+ tomatch = eap->line2;
+ else
+ tomatch = MAXLNUM;
+
/* Get the search pattern: either white-separated or enclosed in // */
regmatch.regprog = NULL;
p = skip_vimgrep_pat(eap->arg, &s, &flags);
@@ -2975,7 +2981,7 @@ ex_vimgrep(eap)
}
seconds = (time_t)0;
- for (fi = 0; fi < fcount && !got_int; ++fi)
+ for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi)
{
if (time(NULL) > seconds)
{
@@ -3035,7 +3041,8 @@ ex_vimgrep(eap)
{
found_match = FALSE;
/* Try for a match in all lines of the buffer. */
- for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
+ for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0;
+ ++lnum)
{
/* For ":1vimgrep" look for multiple matches. */
col = 0;
@@ -3059,8 +3066,9 @@ ex_vimgrep(eap)
got_int = TRUE;
break;
}
- else
- found_match = TRUE;
+ found_match = TRUE;
+ if (--tomatch == 0)
+ break;
if ((flags & VGR_GLOBAL) == 0
|| regmatch.endpos[0].lnum > 0)
break;