mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3292: underscore in very magic pattern causes a hang
Problem: Underscore in very magic pattern causes a hang. Pattern with \V are case sensitive. (Yutao Yuan) Solution: Adjust condition for magicness and advance pointer. (Christian Brabandt, closes #8707, closes #8704, closes #8705)
This commit is contained in:
parent
4a01159da2
commit
bc67e5a0a4
@ -445,7 +445,7 @@ pat_has_uppercase(char_u *pat)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
p += l;
|
p += l;
|
||||||
}
|
}
|
||||||
else if (*p == '\\' && magic_val == MAGIC_ON)
|
else if (*p == '\\' && magic_val <= MAGIC_ON)
|
||||||
{
|
{
|
||||||
if (p[1] == '_' && p[2] != NUL) // skip "\_X"
|
if (p[1] == '_' && p[2] != NUL) // skip "\_X"
|
||||||
p += 3;
|
p += 3;
|
||||||
@ -460,6 +460,8 @@ pat_has_uppercase(char_u *pat)
|
|||||||
{
|
{
|
||||||
if (p[1] != NUL) // skip "_X" and %X
|
if (p[1] != NUL) // skip "_X" and %X
|
||||||
p += 2;
|
p += 2;
|
||||||
|
else
|
||||||
|
p++;
|
||||||
}
|
}
|
||||||
else if (MB_ISUPPER(*p))
|
else if (MB_ISUPPER(*p))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1962,6 +1962,17 @@ func Test_pattern_is_uppercase_smartcase()
|
|||||||
call assert_equal(['abc', 'ABC', 'Abc', ''],
|
call assert_equal(['abc', 'ABC', 'Abc', ''],
|
||||||
\ getline(1, '$'))
|
\ getline(1, '$'))
|
||||||
|
|
||||||
|
call setline(1, input)
|
||||||
|
call cursor(1,1)
|
||||||
|
" \Vabc should match everything
|
||||||
|
%s/\Vabc//g
|
||||||
|
call assert_equal(['', '', '', ''], getline(1, '$'))
|
||||||
|
|
||||||
|
call setline(1, input + ['_abc'])
|
||||||
|
" _ matches normally
|
||||||
|
%s/\v_.*//g
|
||||||
|
call assert_equal(['abc', 'ABC', 'Abc', 'abC', ''], getline(1, '$'))
|
||||||
|
|
||||||
set smartcase& ignorecase&
|
set smartcase& ignorecase&
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
@ -755,6 +755,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 */
|
||||||
|
/**/
|
||||||
|
3292,
|
||||||
/**/
|
/**/
|
||||||
3291,
|
3291,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user