Patch 8.2.4939

7 views
Skip to first unread message

Bram Moolenaar

unread,
May 11, 2022, 9:16:47 AM5/11/22
to vim...@googlegroups.com

Patch 8.2.4939
Problem: matchfuzzypos() with "matchseq" does not have all positions.
Solution: Also add a position for white space. (closes #10404)
Files: runtime/doc/builtin.txt, src/search.c,
src/testdir/test_matchfuzzy.vim


*** ../vim-8.2.4938/runtime/doc/builtin.txt 2022-05-10 17:49:33.259775085 +0100
--- runtime/doc/builtin.txt 2022-05-11 14:10:34.771340086 +0100
***************
*** 5663,5672 ****

The optional {dict} argument always supports the following
items:
! matchseq When this item is present and {str} contains
! multiple words separated by white space, then
! returns only matches that contain the words in
! the given sequence.

If {list} is a list of dictionaries, then the optional {dict}
argument supports the following additional items:
--- 5682,5690 ----

The optional {dict} argument always supports the following
items:
! matchseq When this item is present return only matches
! that contain the characters in {str} in the
! given sequence.

If {list} is a list of dictionaries, then the optional {dict}
argument supports the following additional items:
*** ../vim-8.2.4938/src/search.c 2022-05-09 20:09:19.290641428 +0100
--- src/search.c 2022-05-11 14:10:34.771340086 +0100
***************
*** 4729,4735 ****
p = str;
while (*p != NUL)
{
! if (!VIM_ISWHITE(PTR2CHAR(p)))
{
if (list_append_number(items[match_count].lmatchpos,
matches[j]) == FAIL)
--- 4729,4735 ----
p = str;
while (*p != NUL)
{
! if (!VIM_ISWHITE(PTR2CHAR(p)) || matchseq)
{
if (list_append_number(items[match_count].lmatchpos,
matches[j]) == FAIL)
*** ../vim-8.2.4938/src/testdir/test_matchfuzzy.vim 2022-04-16 12:34:45.485217720 +0100
--- src/testdir/test_matchfuzzy.vim 2022-05-11 14:10:34.775340084 +0100
***************
*** 126,131 ****
--- 126,134 ----

" match multiple words (separated by space)
call assert_equal([['foo bar baz'], [[8, 9, 10, 0, 1, 2]], [369]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('baz foo'))
+ call assert_equal([[], [], []], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('baz foo', {'matchseq': 1}))
+ call assert_equal([['foo bar baz'], [[0, 1, 2, 8, 9, 10]], [369]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('foo baz'))
+ call assert_equal([['foo bar baz'], [[0, 1, 2, 3, 4, 5, 10]], [326]], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('foo baz', {'matchseq': 1}))
call assert_equal([[], [], []], ['foo bar baz', 'foo', 'foo bar', 'baz bar']->matchfuzzypos('one two'))
call assert_equal([[], [], []], ['foo bar']->matchfuzzypos(" \t "))
call assert_equal([['grace'], [[1, 2, 3, 4, 2, 3, 4, 0, 1, 2, 3, 4]], [657]], ['grace']->matchfuzzypos('race ace grace'))
*** ../vim-8.2.4938/src/version.c 2022-05-11 11:42:24.052585610 +0100
--- src/version.c 2022-05-11 14:13:43.843270445 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4939,
/**/

--
hundred-and-one symptoms of being an internet addict:
172. You join listservers just for the extra e-mail.

/// 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