Patch 8.2.1584

4 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 3, 2020, 4:34:32 PM9/3/20
to vim...@googlegroups.com

Patch 8.2.1584
Problem: Vim9: cannot use "true" for "skipstart" in prop_find().
Solution: Use dict_get_bool() instead of tv_get_number(). (closes #6852)
Files: src/textprop.c, src/testdir/test_textprop.vim


*** ../vim-8.2.1583/src/textprop.c 2020-09-02 19:58:56.346255979 +0200
--- src/textprop.c 2020-09-03 22:32:17.817224200 +0200
***************
*** 645,653 ****
return;
}

! di = dict_find(dict, (char_u *)"skipstart", -1);
! if (di != NULL)
! skipstart = tv_get_number(&di->di_tv);

if (dict_find(dict, (char_u *)"id", -1) != NULL)
id = dict_get_number(dict, (char_u *)"id");
--- 645,651 ----
return;
}

! skipstart = dict_get_bool(dict, (char_u *)"skipstart", 0);

if (dict_find(dict, (char_u *)"id", -1) != NULL)
id = dict_get_number(dict, (char_u *)"id");
*** ../vim-8.2.1583/src/testdir/test_textprop.vim 2020-09-02 19:58:56.346255979 +0200
--- src/testdir/test_textprop.vim 2020-09-03 22:28:21.905768057 +0200
***************
*** 212,233 ****
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()
new
--- 212,238 ----
call prop_clear(1,6)
call prop_type_delete('prop_name')

! bwipe!
! endfunc
!
! def Test_prop_find2()
! # Multiple props per line, start on the first, should find the second.
! new
! ['the quikc bronw fox jumsp over the layz dog']->repeat(2)->setline(1)
! prop_type_add('misspell', #{highlight: 'ErrorMsg'})
for lnum in [1, 2]
for col in [8, 14, 24, 38]
! prop_add(lnum, col, #{type: 'misspell', length: 2})
endfor
endfor
! cursor(1, 8)
! let expected = {'lnum': 1, 'id': 0, 'col': 14, 'end': 1, 'type': 'misspell', 'length': 2, 'start': 1}
! let result = prop_find(#{type: 'misspell', skipstart: true}, 'f')
! assert_equal(expected, result)

! prop_type_delete('misspell')
bwipe!
! enddef

func Test_prop_find_smaller_len_than_match_col()
new
*** ../vim-8.2.1583/src/version.c 2020-09-03 19:50:01.754364669 +0200
--- src/version.c 2020-09-03 22:29:53.017559686 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1584,
/**/

--
WOMAN: Dennis, there's some lovely filth down here. Oh -- how d'you do?
ARTHUR: How do you do, good lady. I am Arthur, King of the Britons.
Who's castle is that?
WOMAN: King of the who?
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/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages