aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-04 10:32:20 +0800
committerGitHub <noreply@github.com>2022-12-04 10:32:20 +0800
commita0dd663c2d321ce107aa07005aa01b9c341c5df2 (patch)
tree32295d58a80f90a2d3b1d66d9034c7bd2fc4a093 /src/nvim/regexp.c
parentfba0562723a1af143c9e9509920d03d8231b8bf7 (diff)
parent9476dd2f923d9e5d86237836131f67024613308f (diff)
downloadrneovim-a0dd663c2d321ce107aa07005aa01b9c341c5df2.tar.gz
rneovim-a0dd663c2d321ce107aa07005aa01b9c341c5df2.tar.bz2
rneovim-a0dd663c2d321ce107aa07005aa01b9c341c5df2.zip
Merge pull request #21279 from zeertzjq/vim-8.2.2182
vim-patch:8.2.{2182,2295,3265,3292}: search fixes
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c17
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;
}