diff options
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index e58a8fa06a..7335345161 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -316,11 +316,7 @@ static int re_has_z; ///< \z item detected static unsigned regflags; ///< RF_ flags for prog static int had_eol; ///< true when EOL found by vim_regcomp() -static int reg_magic; // magicness of the pattern: -#define MAGIC_NONE 1 // "\V" very unmagic -#define MAGIC_OFF 2 // "\M" or 'magic' off -#define MAGIC_ON 3 // "\m" or 'magic' -#define MAGIC_ALL 4 // "\v" very magic +static magic_T reg_magic; ///< magicness of the pattern static int reg_string; // matching with a string instead of a buffer // line @@ -485,7 +481,7 @@ static char_u *skip_anyof(char *p) /// Skip strings inside [ and ]. char *skip_regexp(char *startp, int delim, int magic) { - return skip_regexp_ex(startp, delim, magic, NULL, NULL); + return skip_regexp_ex(startp, delim, magic, NULL, NULL, NULL); } /// Call skip_regexp() and when the delimiter does not match give an error and @@ -506,9 +502,11 @@ char *skip_regexp_err(char *startp, int delim, int magic) /// expression and change "\?" to "?". If "*newp" is not NULL the expression /// is changed in-place. /// If a "\?" is changed to "?" then "dropped" is incremented, unless NULL. -char *skip_regexp_ex(char *startp, int dirc, int magic, char **newp, int *dropped) +/// If "magic_val" is not NULL, returns the effective magicness of the pattern +char *skip_regexp_ex(char *startp, int dirc, int magic, char **newp, int *dropped, + magic_T *magic_val) { - int mymagic; + magic_T mymagic; char *p = startp; if (magic) { @@ -549,6 +547,9 @@ char *skip_regexp_ex(char *startp, int dirc, int magic, char **newp, int *droppe } } } + if (magic_val != NULL) { + *magic_val = mymagic; + } return p; } |