]> granicus.if.org Git - vim/commitdiff
patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find() v8.2.1584
authorBram Moolenaar <Bram@vim.org>
Thu, 3 Sep 2020 20:33:44 +0000 (22:33 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 3 Sep 2020 20:33:44 +0000 (22:33 +0200)
Problem:    Vim9: cannot use "true" for "skipstart" in prop_find().
Solution:   Use dict_get_bool() instead of tv_get_number(). (closes #6852)

src/testdir/test_textprop.vim
src/textprop.c
src/version.c

index 5990fbf3f1882d08cd640de966d31eda4757dd0b..bacb288c521799cc6a713fc112ec3b2806953eef 100644 (file)
@@ -212,22 +212,27 @@ func Test_prop_find()
   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'})
+  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]
-      call prop_add(lnum, col, #{type: 'misspell', length: 2})
+      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)
+  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)
 
-  call prop_type_delete('misspell')
+  prop_type_delete('misspell')
   bwipe!
-endfunc
+enddef
 
 func Test_prop_find_smaller_len_than_match_col()
   new
index 9dff6b869fd979be944c89ea56f204fa2ff76dca..beb9a273d0e1ace2fe1912a04bc559e31646d0e3 100644 (file)
@@ -645,9 +645,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
        return;
     }
 
-    di = dict_find(dict, (char_u *)"skipstart", -1);
-    if (di != NULL)
-       skipstart = tv_get_number(&di->di_tv);
+    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");
index de956a642d4685f882d2550658ff61ce857d7420..116fab9d2be98198e08e9d343c2638da3db5deda 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1584,
 /**/
     1583,
 /**/