Skip to content

Commit eb24556

Browse files
committed
patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Problem: Vim9: cannot use "true" for "skipstart" in prop_find(). Solution: Use dict_get_bool() instead of tv_get_number(). (closes #6852)
1 parent 18eedfa commit eb24556

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

src/testdir/test_textprop.vim

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,22 +212,27 @@ func Test_prop_find()
212212
call prop_clear(1,6)
213213
call prop_type_delete('prop_name')
214214

215-
" Multiple props per line, start on the first, should find the second.
216-
let expected = {'lnum': 1, 'id': 0, 'col': 14, 'end': 1, 'type': 'misspell', 'length': 2, 'start': 1}
217-
eval ['the quikc bronw fox jumsp over the layz dog']->repeat(2)->setline(1)
218-
call prop_type_add('misspell', #{highlight: 'ErrorMsg'})
215+
bwipe!
216+
endfunc
217+
218+
def Test_prop_find2()
219+
# Multiple props per line, start on the first, should find the second.
220+
new
221+
['the quikc bronw fox jumsp over the layz dog']->repeat(2)->setline(1)
222+
prop_type_add('misspell', #{highlight: 'ErrorMsg'})
219223
for lnum in [1, 2]
220224
for col in [8, 14, 24, 38]
221-
call prop_add(lnum, col, #{type: 'misspell', length: 2})
225+
prop_add(lnum, col, #{type: 'misspell', length: 2})
222226
endfor
223227
endfor
224-
call cursor(1, 8)
225-
let result = prop_find(#{type: 'misspell', skipstart: 1}, 'f')
226-
call assert_equal(expected, result)
228+
cursor(1, 8)
229+
let expected = {'lnum': 1, 'id': 0, 'col': 14, 'end': 1, 'type': 'misspell', 'length': 2, 'start': 1}
230+
let result = prop_find(#{type: 'misspell', skipstart: true}, 'f')
231+
assert_equal(expected, result)
227232

228-
call prop_type_delete('misspell')
233+
prop_type_delete('misspell')
229234
bwipe!
230-
endfunc
235+
enddef
231236

232237
func Test_prop_find_smaller_len_than_match_col()
233238
new

src/textprop.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,9 +645,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
645645
return;
646646
}
647647

648-
di = dict_find(dict, (char_u *)"skipstart", -1);
649-
if (di != NULL)
650-
skipstart = tv_get_number(&di->di_tv);
648+
skipstart = dict_get_bool(dict, (char_u *)"skipstart", 0);
651649

652650
if (dict_find(dict, (char_u *)"id", -1) != NULL)
653651
id = dict_get_number(dict, (char_u *)"id");

src/version.c

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

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1584,
757759
/**/
758760
1583,
759761
/**/

0 commit comments

Comments
 (0)