aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/regexp.c4
-rw-r--r--test/old/testdir/test_regexp_latin.vim14
2 files changed, 16 insertions, 2 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 86082adbb6..08c804bca5 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -4494,7 +4494,7 @@ static uint8_t *regatom(int *flagp)
n = n * 10 + (uint32_t)(c - '0');
c = getchr();
}
- if (c == '\'' && n == 0) {
+ if (no_Magic(c) == '\'' && n == 0) {
// "\%'m", "\%<'m" and "\%>'m": Mark
c = getchr();
ret = regnode(RE_MARK);
@@ -10218,7 +10218,7 @@ static int nfa_regatom(void)
}
EMIT((int)n);
break;
- } else if (c == '\'' && n == 0) {
+ } else if (no_Magic(c) == '\'' && n == 0) {
// \%'m \%<'m \%>'m
EMIT(cmp == '<' ? NFA_MARK_LT
: cmp == '>' ? NFA_MARK_GT : NFA_MARK);
diff --git a/test/old/testdir/test_regexp_latin.vim b/test/old/testdir/test_regexp_latin.vim
index ece6ae518e..62771c9743 100644
--- a/test/old/testdir/test_regexp_latin.vim
+++ b/test/old/testdir/test_regexp_latin.vim
@@ -842,12 +842,26 @@ func Regex_Mark()
%d
endfunc
+" Same test as abobe, but use verymagic
+func Regex_Mark_Verymagic()
+ call append(0, ['', '', '', 'Marks:', 'asdfSasdfsadfEasdf', 'asdfSas',
+ \ 'dfsadfEasdf', '', '', '', '', ''])
+ call cursor(4, 1)
+ exe "normal jfSmsfEme:.-4,.+6s/\\v.%>'s.*%<'e../here/\<CR>"
+ exe "normal jfSmsj0fEme:.-4,.+6s/\\v.%>'s\\_.*%<'e../again/\<CR>"
+ call assert_equal(['', '', '', 'Marks:', 'asdfhereasdf', 'asdfagainasdf',
+ \ '', '', '', '', '', ''], getline(1, '$'))
+ %d
+endfunc
+
func Test_matching_marks()
new
set regexpengine=1
call Regex_Mark()
+ call Regex_Mark_Verymagic()
set regexpengine=2
call Regex_Mark()
+ call Regex_Mark_Verymagic()
bwipe!
endfunc