]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3257: calling prop_find() with -1 for ID gives errornous error v8.2.3257
authorBram Moolenaar <Bram@vim.org>
Sat, 31 Jul 2021 16:33:57 +0000 (18:33 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 31 Jul 2021 16:33:57 +0000 (18:33 +0200)
Problem:    Calling prop_find() with -1 for ID gives errornous error. (Naohiro
            Ono)
Solution:   When passing -1 use -2. (closes #8674)

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

index 78dd2029a82f2830c10118f52edcd1336022bab6..0ac4e898fc3f7e24b7a38d86cd267483a2609afe 100644 (file)
@@ -239,6 +239,9 @@ func Test_prop_find()
   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')
 
index 92dc645b09772e446362113bd96948405a396160..bc27aef6e7b036802c901b1381fcb111c04cf335 100644 (file)
@@ -686,7 +686,11 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
     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");
+       if (id == -1)
+           id = -2;
+    }
     if (dict_find(dict, (char_u *)"type", -1))
     {
        char_u      *name = dict_get_string(dict, (char_u *)"type", FALSE);
index 2ef52377903e1ef59ba637f980ae23c794c87fe3..917e001cd01ba94be32b742ab2c9487804045b8e 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3257,
 /**/
     3256,
 /**/