Patch 8.2.3272

5 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 1, 2021, 3:30:44 PM8/1/21
to vim...@googlegroups.com

Patch 8.2.3272
Problem: Cannot use id zero with prop_find(). (Naohiro Ono)
Solution: Also accept id zero.
Files: src/textprop.c, src/testdir/test_textprop.vim


*** ../vim-8.2.3271/src/textprop.c 2021-08-01 19:28:11.167063929 +0200
--- src/textprop.c 2021-08-01 21:29:12.353322496 +0200
***************
*** 689,695 ****
if (dict_find(dict, (char_u *)"id", -1) != NULL)
{
id = dict_get_number(dict, (char_u *)"id");
! id_found = id != 0;
}
if (dict_find(dict, (char_u *)"type", -1))
{
--- 689,695 ----
if (dict_find(dict, (char_u *)"id", -1) != NULL)
{
id = dict_get_number(dict, (char_u *)"id");
! id_found = TRUE;
}
if (dict_find(dict, (char_u *)"type", -1))
{
*** ../vim-8.2.3271/src/testdir/test_textprop.vim 2021-07-31 18:33:53.180698143 +0200
--- src/testdir/test_textprop.vim 2021-08-01 21:28:47.561376303 +0200
***************
*** 239,250 ****
let result = prop_find({'type': 'prop_name', 'lnum': 1}, 'f')
call assert_equal(expected[0], result)

! " When ID is -1 it's like prop is not found.
call assert_equal({}, prop_find({'id': -1}))

! call prop_clear(1,6)
! call prop_type_delete('prop_name')

bwipe!
endfunc

--- 239,256 ----
let result = prop_find({'type': 'prop_name', 'lnum': 1}, 'f')
call assert_equal(expected[0], result)

! " Negative ID is possible, just like prop is not found.
call assert_equal({}, prop_find({'id': -1}))
+ call assert_equal({}, prop_find({'id': -2}))

! call prop_clear(1, 6)
!
! " Default ID is zero
! call prop_add(5, 4, {'type': 'prop_name', 'length': 1})
! call assert_equal(#{lnum: 5, id: 0, col: 4, type_bufnr: 0, end: 1, type: 'prop_name', length: 1, start: 1}, prop_find({'id': 0}))

+ call prop_type_delete('prop_name')
+ call prop_clear(1, 6)
bwipe!
endfunc

*** ../vim-8.2.3271/src/version.c 2021-08-01 21:19:40.130538381 +0200
--- src/version.c 2021-08-01 21:29:36.113270868 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3272,
/**/

--
"To whoever finds this note -
I have been imprisoned by my father who wishes me to marry
against my will. Please please please please come and rescue me.
I am in the tall tower of Swamp Castle."
SIR LAUNCELOT's eyes light up with holy inspiration.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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