diff options
-rw-r--r-- | src/nvim/ex_cmds.c | 44 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 46 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 45 insertions, 47 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index ab85bb766f..95cbcbbcb9 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -6159,6 +6159,50 @@ void ex_substitute(exarg_T *eap) unblock_autocmds(); } +/// Skip over the pattern argument of ":vimgrep /pat/[g][j]". +/// Put the start of the pattern in "*s", unless "s" is NULL. +/// If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP. +/// If "s" is not NULL terminate the pattern with a NUL. +/// Return a pointer to the char just past the pattern plus flags. +char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags) +{ + int c; + + if (vim_isIDc(*p)) { + // ":vimgrep pattern fname" + if (s != NULL) + *s = p; + p = skiptowhite(p); + if (s != NULL && *p != NUL) + *p++ = NUL; + } else { + // ":vimgrep /pattern/[g][j] fname" + if (s != NULL) + *s = p + 1; + c = *p; + p = skip_regexp(p + 1, c, TRUE, NULL); + if (*p != c) + return NULL; + + // Truncate the pattern. + if (s != NULL) + *p = NUL; + ++p; + + // Find the flags + while (*p == 'g' || *p == 'j') { + if (flags != NULL) { + if (*p == 'g') + *flags |= VGR_GLOBAL; + else + *flags |= VGR_NOJUMP; + } + ++p; + } + } + return p; +} + /// List v:oldfiles in a nice way. void ex_oldfiles(exarg_T *eap) { diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 112498ae20..0ec0d5df9d 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3766,52 +3766,6 @@ theend: } /* - * Skip over the pattern argument of ":vimgrep /pat/[g][j]". - * Put the start of the pattern in "*s", unless "s" is NULL. - * If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP. - * If "s" is not NULL terminate the pattern with a NUL. - * Return a pointer to the char just past the pattern plus flags. - */ -char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags) -{ - int c; - - if (vim_isIDc(*p)) { - /* ":vimgrep pattern fname" */ - if (s != NULL) - *s = p; - p = skiptowhite(p); - if (s != NULL && *p != NUL) - *p++ = NUL; - } else { - /* ":vimgrep /pattern/[g][j] fname" */ - if (s != NULL) - *s = p + 1; - c = *p; - p = skip_regexp(p + 1, c, TRUE, NULL); - if (*p != c) - return NULL; - - /* Truncate the pattern. */ - if (s != NULL) - *p = NUL; - ++p; - - /* Find the flags */ - while (*p == 'g' || *p == 'j') { - if (flags != NULL) { - if (*p == 'g') - *flags |= VGR_GLOBAL; - else - *flags |= VGR_NOJUMP; - } - ++p; - } - } - return p; -} - -/* * Restore current working directory to "dirname_start" if they differ, taking * into account whether it is set locally or globally. */ diff --git a/src/nvim/version.c b/src/nvim/version.c index b3ab5d0d2c..cdd617e68c 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -205,7 +205,7 @@ static const int included_patches[] = { 2242, 2241, 2240, - // 2239, + 2239, // 2238 NA 2237, 2236, |