diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-04 12:42:13 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-04 12:42:13 +0100 |
commit | d93a7fc1a98a58f8101ee780d4735079ad99ae35 (patch) | |
tree | 15445b4ab17588d6786645d1ff1235dfd4bb9fb6 /src/regexp.c | |
parent | 82c38fe508155c11a904e6111b5bfb6adde3fb9a (diff) |
patch 8.2.2295: incsearch does not detect empty pattern properlyv8.2.2295
Problem: Incsearch does not detect empty pattern properly.
Solution: Return magic state when skipping over a pattern. (Christian
Brabandt, closes #7612, closes #6420)
Diffstat (limited to 'src/regexp.c')
-rw-r--r-- | src/regexp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/regexp.c b/src/regexp.c index 0fd6de61ec..9d2d441fc4 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -304,11 +304,7 @@ static unsigned regflags; // RF_ flags for prog static int had_eol; // TRUE when EOL found by vim_regcomp() #endif -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 @@ -548,7 +544,7 @@ skip_regexp( int delim, int magic) { - return skip_regexp_ex(startp, delim, magic, NULL, NULL); + return skip_regexp_ex(startp, delim, magic, NULL, NULL, NULL); } /* @@ -577,6 +573,7 @@ skip_regexp_err( * 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. + * If "magic_val" is not NULL, returns the effective magicness of the pattern */ char_u * skip_regexp_ex( @@ -584,9 +581,10 @@ skip_regexp_ex( int dirc, int magic, char_u **newp, - int *dropped) + int *dropped, + magic_T *magic_val) { - int mymagic; + magic_T mymagic; char_u *p = startp; if (magic) @@ -632,6 +630,8 @@ skip_regexp_ex( mymagic = MAGIC_NONE; } } + if (magic_val != NULL) + *magic_val = mymagic; return p; } |