Mercurial > vim
diff src/regexp.c @ 23505:bb29b09902d5 v8.2.2295
patch 8.2.2295: incsearch does not detect empty pattern properly
Commit: https://github.com/vim/vim/commit/d93a7fc1a98a58f8101ee780d4735079ad99ae35
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 4 12:42:13 2021 +0100
patch 8.2.2295: incsearch does not detect empty pattern properly
Problem: Incsearch does not detect empty pattern properly.
Solution: Return magic state when skipping over a pattern. (Christian
Brabandt, closes #7612, closes #6420)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 04 Jan 2021 12:45:05 +0100 |
parents | a7cdfc8e4b6e |
children | f293bb501b30 |
line wrap: on
line diff
--- a/src/regexp.c +++ b/src/regexp.c @@ -304,11 +304,7 @@ static unsigned regflags; // RF_ flags f 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; }