Patch 8.2.3292

4 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 5, 2021, 9:25:40 AM8/5/21
to vim...@googlegroups.com

Patch 8.2.3292
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)
Files: src/search.c, src/testdir/test_search.vim


*** ../vim-8.2.3291/src/search.c 2021-08-01 12:44:31.856542627 +0200
--- src/search.c 2021-08-05 15:20:17.820185295 +0200
***************
*** 445,451 ****
return TRUE;
p += l;
}
! else if (*p == '\\' && magic_val == MAGIC_ON)
{
if (p[1] == '_' && p[2] != NUL) // skip "\_X"
p += 3;
--- 445,451 ----
return TRUE;
p += l;
}
! else if (*p == '\\' && magic_val <= MAGIC_ON)
{
if (p[1] == '_' && p[2] != NUL) // skip "\_X"
p += 3;
***************
*** 460,465 ****
--- 460,467 ----
{
if (p[1] != NUL) // skip "_X" and %X
p += 2;
+ else
+ p++;
}
else if (MB_ISUPPER(*p))
return TRUE;
*** ../vim-8.2.3291/src/testdir/test_search.vim 2021-08-01 12:44:31.856542627 +0200
--- src/testdir/test_search.vim 2021-08-05 15:20:17.820185295 +0200
***************
*** 1962,1967 ****
--- 1962,1978 ----
call assert_equal(['abc', 'ABC', 'Abc', ''],
\ 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&
bw!
endfunc
*** ../vim-8.2.3291/src/version.c 2021-08-05 15:11:04.577422906 +0200
--- src/version.c 2021-08-05 15:24:35.283597372 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3292,
/**/

--
GUARD #2: It could be carried by an African swallow!
GUARD #1: Oh, yeah, an African swallow maybe, but not a European swallow,
that's my point.
GUARD #2: Oh, yeah, I agree with that...
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages