0
0
mirror of https://github.com/vim/vim.git synced 2025-08-23 19:34:27 -04:00

updated for version 7.3.1010

Problem:    New regexp: adding \Z makes every character match.
Solution:   Only apply ireg_icombine for composing characters.
            Alsl add missing change from patch 1008. (Ken Takata)
This commit is contained in:
Bram Moolenaar 2013-05-24 20:25:33 +02:00
parent 425154d888
commit 1d814754c0
4 changed files with 12 additions and 13 deletions

View File

@ -2859,7 +2859,7 @@ nfa_regmatch(start, submatch, m)
List *listtbl[2][2]; List *listtbl[2][2];
List *ll; List *ll;
int listid = 1; int listid = 1;
int endnode = 0; int endnode;
List *thislist; List *thislist;
List *nextlist; List *nextlist;
List *neglist; List *neglist;
@ -3192,13 +3192,7 @@ nfa_regmatch(start, submatch, m)
case NFA_MULTIBYTE: case NFA_MULTIBYTE:
case NFA_COMPOSING: case NFA_COMPOSING:
switch (t->state->c) endnode = t->state->c + 1;
{
case NFA_MULTIBYTE: endnode = NFA_END_MULTIBYTE; break;
case NFA_COMPOSING: endnode = NFA_END_COMPOSING; break;
default: endnode = 0;
}
result = OK; result = OK;
sta = t->state->out; sta = t->state->out;
len = 1; len = 1;
@ -3206,7 +3200,7 @@ nfa_regmatch(start, submatch, m)
{ {
if (reginput[len-1] != sta->c) if (reginput[len-1] != sta->c)
{ {
result = OK - 1; result = FAIL;
break; break;
} }
len++; len++;
@ -3215,11 +3209,11 @@ nfa_regmatch(start, submatch, m)
/* if input char length doesn't match regexp char length */ /* if input char length doesn't match regexp char length */
if (len -1 < n || sta->c != endnode) if (len -1 < n || sta->c != endnode)
result = OK - 1; result = FAIL;
end = t->state->out1; /* NFA_END_MULTIBYTE or end = t->state->out1; /* NFA_END_MULTIBYTE or
NFA_END_COMPOSING */ NFA_END_COMPOSING */
/* If \Z was present, then ignore composing characters */ /* If \Z was present, then ignore composing characters */
if (regflags & RF_ICOMBINE) if (ireg_icombine && endnode == NFA_END_COMPOSING)
result = 1 ^ sta->negated; result = 1 ^ sta->negated;
ADD_POS_NEG_STATE(end); ADD_POS_NEG_STATE(end);
break; break;

View File

@ -7,7 +7,7 @@ actually tried.
STARTTEST STARTTEST
:so small.vim :so small.vim
:so mbyte.vim :so mbyte.vim
:set nocp encoding=utf-8 viminfo+=nviminfo :set nocp encoding=utf-8 viminfo+=nviminfo nomore
:" tl is a List of Lists with: :" tl is a List of Lists with:
:" regexp pattern :" regexp pattern
:" text to test the pattern on :" text to test the pattern on
@ -35,11 +35,13 @@ STARTTEST
:call add(tl, ['\f\+', '&*Ÿfname ', 'fname']) :call add(tl, ['\f\+', '&*Ÿfname ', 'fname'])
:call add(tl, ['\%#=1\f\+', '&*Ÿfname ', 'fname']) :call add(tl, ['\%#=1\f\+', '&*Ÿfname ', 'fname'])
:"""" Test \Z
:call add(tl, ['ú\Z', 'x'])
:"""" Combining different tests and features :"""" Combining different tests and features
:call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd']) :call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd'])
:"""" Run the tests :"""" Run the tests
:" :"
:for t in tl :for t in tl
: let l = matchlist(t[1], t[0]) : let l = matchlist(t[1], t[0])

View File

@ -9,4 +9,5 @@ OK - \i\+
OK - \%#=1\i\+ OK - \%#=1\i\+
OK - \f\+ OK - \f\+
OK - \%#=1\f\+ OK - \%#=1\f\+
OK - ú\Z
OK - [^[=a=]]\+ OK - [^[=a=]]\+

View File

@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1010,
/**/ /**/
1009, 1009,
/**/ /**/