diff options
author | Michael Ennen <mike.ennen@gmail.com> | 2016-07-19 23:24:42 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-08-01 03:59:04 -0400 |
commit | 6fe8c1d0513c0facefa9b80078792dba627ec7a7 (patch) | |
tree | 35ce7336e637c6193ed451ca88293b2256e9589c /src/nvim/regexp.c | |
parent | 23f591dba078fee16ab6e4debfcd051e799ca4f8 (diff) | |
download | rneovim-6fe8c1d0513c0facefa9b80078792dba627ec7a7.tar.gz rneovim-6fe8c1d0513c0facefa9b80078792dba627ec7a7.tar.bz2 rneovim-6fe8c1d0513c0facefa9b80078792dba627ec7a7.zip |
vim-patch:7.4.1305 #5094
Problem: "\%1l^#.*" does not match on a line starting with "#".
Solution: Do not clear the start-of-line flag. (Christian Brabandt)
https://github.com/vim/vim/commit/7c29f387819b5817b003d2ba73e2b5cf3cb3d0dd
Helped-by: jamessan
Helped-by: mhinz
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 886a48e7c5..f8fd7d4ef8 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -1389,6 +1389,10 @@ int vim_regcomp_had_eol(void) return had_eol; } +// variables for parsing reginput +static int at_start; // True when on the first character +static int prev_at_start; // True when on the second character + /* * Parse regular expression, i.e. main body or parenthesized thing. * @@ -1768,6 +1772,7 @@ static char_u *regatom(int *flagp) int c; char_u *p; int extra = 0; + int save_prev_at_start = prev_at_start; *flagp = WORST; /* Tentatively. */ @@ -2143,17 +2148,21 @@ static char_u *regatom(int *flagp) } break; } else if (c == 'l' || c == 'c' || c == 'v') { - if (c == 'l') + if (c == 'l') { ret = regnode(RE_LNUM); - else if (c == 'c') + if (save_prev_at_start) { + at_start = true; + } + } else if (c == 'c') { ret = regnode(RE_COL); - else + } else { ret = regnode(RE_VCOL); - if (ret == JUST_CALC_SIZE) + } + if (ret == JUST_CALC_SIZE) { regsize += 5; - else { - /* put the number and the optional - * comparator after the opcode */ + } else { + // put the number and the optional + // comparator after the opcode regcode = re_put_uint32(regcode, n); *regcode++ = cmp; } @@ -2679,9 +2688,6 @@ static void regoptail(char_u *p, char_u *val) * Functions for getting characters from the regexp input. */ -static int at_start; /* True when on the first character */ -static int prev_at_start; /* True when on the second character */ - /* * Start parsing at "str". */ |