Patch 8.2.1568
Problem: prop_find() skips properties in the same line if "skipstart" is
used.
Solution: Use "continue" instead of "break". (closes #6840)
Files: src/textprop.c, src/testdir/test_textprop.vim
*** ../vim-8.2.1567/src/textprop.c 2020-06-29 23:02:15.867887636 +0200
--- src/textprop.c 2020-09-02 19:57:27.718525035 +0200
***************
*** 718,724 ****
// on a prop and we're not skipping.
if (start_pos_has_prop && !skipstart)
dir = -1;
! break;
}
// If skipstart is true, skip the prop at start pos (even if
--- 718,724 ----
// on a prop and we're not skipping.
if (start_pos_has_prop && !skipstart)
dir = -1;
! continue;
}
// If skipstart is true, skip the prop at start pos (even if
***************
*** 726,732 ****
if (start_pos_has_prop && skipstart && !seen_end)
{
start_pos_has_prop = 0;
! break;
}
prop_fill_dict(rettv->vval.v_dict, &prop, buf);
--- 726,732 ----
if (start_pos_has_prop && skipstart && !seen_end)
{
start_pos_has_prop = 0;
! continue;
}
prop_fill_dict(rettv->vval.v_dict, &prop, buf);
*** ../vim-8.2.1567/src/testdir/test_textprop.vim 2020-07-30 20:08:46.840890218 +0200
--- src/testdir/test_textprop.vim 2020-09-02 19:44:58.784819709 +0200
***************
*** 211,216 ****
--- 211,232 ----
call prop_clear(1,6)
call prop_type_delete('prop_name')
+
+ " Multiple props per line, start on the first, should find the second.
+ let expected = {'lnum': 1, 'id': 0, 'col': 14, 'end': 1, 'type': 'misspell', 'length': 2, 'start': 1}
+ eval ['the quikc bronw fox jumsp over the layz dog']->repeat(2)->setline(1)
+ call prop_type_add('misspell', #{highlight: 'ErrorMsg'})
+ for lnum in [1, 2]
+ for col in [8, 14, 24, 38]
+ call prop_add(lnum, col, #{type: 'misspell', length: 2})
+ endfor
+ endfor
+ call cursor(1, 8)
+ let result = prop_find(#{type: 'misspell', skipstart: 1}, 'f')
+ call assert_equal(expected, result)
+
+ call prop_type_delete('misspell')
+ bwipe!
endfunc
func Test_prop_find_smaller_len_than_match_col()
*** ../vim-8.2.1567/src/version.c 2020-09-02 19:23:03.636776329 +0200
--- src/version.c 2020-09-02 19:56:02.790783164 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1568,
/**/
--
"A mouse can be just as dangerous as a bullet or a bomb."
(US Representative Lamar Smith, R-Texas)
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///