Skip to content

Commit e041dde

Browse files
committed
patch 8.2.3272: cannot use id zero with prop_find()
Problem: Cannot use id zero with prop_find(). (Naohiro Ono) Solution: Also accept id zero.
1 parent e4db17f commit e041dde

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/testdir/test_textprop.vim

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,18 @@ func Test_prop_find()
239239
let result = prop_find({'type': 'prop_name', 'lnum': 1}, 'f')
240240
call assert_equal(expected[0], result)
241241

242-
" When ID is -1 it's like prop is not found.
242+
" Negative ID is possible, just like prop is not found.
243243
call assert_equal({}, prop_find({'id': -1}))
244+
call assert_equal({}, prop_find({'id': -2}))
244245

245-
call prop_clear(1,6)
246-
call prop_type_delete('prop_name')
246+
call prop_clear(1, 6)
247+
248+
" Default ID is zero
249+
call prop_add(5, 4, {'type': 'prop_name', 'length': 1})
250+
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}))
247251

252+
call prop_type_delete('prop_name')
253+
call prop_clear(1, 6)
248254
bwipe!
249255
endfunc
250256

src/textprop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
689689
if (dict_find(dict, (char_u *)"id", -1) != NULL)
690690
{
691691
id = dict_get_number(dict, (char_u *)"id");
692-
id_found = id != 0;
692+
id_found = TRUE;
693693
}
694694
if (dict_find(dict, (char_u *)"type", -1))
695695
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3272,
758760
/**/
759761
3271,
760762
/**/

0 commit comments

Comments
 (0)