aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp_bt.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-05 15:56:15 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-05 16:09:22 +0800
commit77e25e56d8ccc0c174305f9fe64ad06f0223ab2d (patch)
tree53ae80ab4a55488b30ae170f22c6f71d0baa3172 /src/nvim/regexp_bt.c
parent78e69412acb481c7ad56e68c541f5c5383992d5b (diff)
downloadrneovim-77e25e56d8ccc0c174305f9fe64ad06f0223ab2d.tar.gz
rneovim-77e25e56d8ccc0c174305f9fe64ad06f0223ab2d.tar.bz2
rneovim-77e25e56d8ccc0c174305f9fe64ad06f0223ab2d.zip
vim-patch:8.2.4693: new regexp does not accept pattern "\%>0v"
Problem: new regexp does not accept pattern "\%>0v". Solution: Do accept digit zero. https://github.com/vim/vim/commit/72bb10df1fb3eb69bc91f5babfb8881ce098cba1 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/regexp_bt.c')
-rw-r--r--src/nvim/regexp_bt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/regexp_bt.c b/src/nvim/regexp_bt.c
index bde2962d3b..f0efd06cc0 100644
--- a/src/nvim/regexp_bt.c
+++ b/src/nvim/regexp_bt.c
@@ -2091,6 +2091,7 @@ static char_u *regatom(int *flagp)
uint32_t n = 0;
int cmp;
bool cur = false;
+ bool got_digit = false;
cmp = c;
if (cmp == '<' || cmp == '>') {
@@ -2101,6 +2102,7 @@ static char_u *regatom(int *flagp)
c = getchr();
}
while (ascii_isdigit(c)) {
+ got_digit = true;
n = n * 10 + (uint32_t)(c - '0');
c = getchr();
}
@@ -2115,7 +2117,7 @@ static char_u *regatom(int *flagp)
*regcode++ = (char_u)cmp;
}
break;
- } else if (c == 'l' || c == 'c' || c == 'v') {
+ } else if ((c == 'l' || c == 'c' || c == 'v') && (cur || got_digit)) {
if (cur && n) {
semsg(_(e_regexp_number_after_dot_pos_search_chr), no_Magic(c));
rc_did_emsg = true;