Patch 9.0.1555
Problem: setcharsearch() does not clear last searched char properly.
Solution: Do not accept lastc_bytelen smaller than one. (closes #12398)
Files: src/search.c, src/testdir/test_charsearch.vim,
src/testdir/test_charsearch_utf8.vim
*** ../vim-9.0.1554/src/search.c 2023-05-06 19:19:59.428601312 +0100
--- src/search.c 2023-05-14 17:35:01.042956228 +0100
***************
*** 496,502 ****
}
void
! set_last_csearch(int c, char_u *s UNUSED, int len UNUSED)
{
*lastc = c;
lastc_bytelen = len;
--- 496,502 ----
}
void
! set_last_csearch(int c, char_u *s, int len)
{
*lastc = c;
lastc_bytelen = len;
***************
*** 1789,1795 ****
}
else // repeat previous search
{
! if (*lastc == NUL && lastc_bytelen == 1)
return FAIL;
if (dir) // repeat in opposite direction
dir = -lastcdir;
--- 1789,1795 ----
}
else // repeat previous search
{
! if (*lastc == NUL && lastc_bytelen <= 1)
return FAIL;
if (dir) // repeat in opposite direction
dir = -lastcdir;
***************
*** 1833,1839 ****
return FAIL;
col -= (*mb_head_off)(p, p + col - 1) + 1;
}
! if (lastc_bytelen == 1)
{
if (p[col] == c && stop)
break;
--- 1833,1839 ----
return FAIL;
col -= (*mb_head_off)(p, p + col - 1) + 1;
}
! if (lastc_bytelen <= 1)
{
if (p[col] == c && stop)
break;
*** ../vim-9.0.1554/src/testdir/test_charsearch.vim 2022-08-30
19:48:17.206760205 +0100
--- src/testdir/test_charsearch.vim 2023-05-14 17:35:01.042956228 +0100
***************
*** 38,43 ****
--- 38,45 ----
" clear the character search
call setcharsearch({'char' : ''})
call assert_equal('', getcharsearch().char)
+ call assert_beeps('normal ;')
+ call assert_beeps('normal ,')
call assert_fails("call setcharsearch([])", 'E1206:')
enew!
*** ../vim-9.0.1554/src/testdir/test_charsearch_utf8.vim 2019-01-24
16:36:06.000000000 +0000
--- src/testdir/test_charsearch_utf8.vim 2023-05-14 17:35:01.042956228
+0100
***************
*** 13,18 ****
--- 13,25 ----
call assert_equal([0, 1, 43, 0], getpos('.'))
normal! ,
call assert_equal([0, 1, 28, 0], getpos('.'))
+ call assert_equal('最', getcharsearch().char)
+ call setcharsearch({'char' : ''})
+ call assert_equal('', getcharsearch().char)
+ call assert_beeps('normal ;')
+ call assert_equal([0, 1, 28, 0], getpos('.'))
+ call assert_beeps('normal ,')
+ call assert_equal([0, 1, 28, 0], getpos('.'))
bw!
endfunc
*** ../vim-9.0.1554/src/version.c 2023-05-14 17:24:18.148997087 +0100
--- src/version.c 2023-05-14 17:37:35.670702296 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1555,
/**/
--
hundred-and-one symptoms of being an internet addict:
32. You don't know what sex three of your closest friends are, because they
have neutral nicknames and you never bothered to ask.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230514163948.646BA1C1B21%40moolenaar.net.