]> granicus.if.org Git - vim/commitdiff
patch 8.2.0378: prop_find() does not find all props v8.2.0378
authorBram Moolenaar <Bram@vim.org>
Fri, 13 Mar 2020 20:36:40 +0000 (21:36 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 13 Mar 2020 20:36:40 +0000 (21:36 +0100)
Problem:    prop_find() does not find all props.
Solution:   Check being in the start line. (Axel Forsman, closes #5776)

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

index 6d3aaa3be0870c1e1f785eaf79964383b075ea5b..692b0c4bd01ef2427189ebeb69b0d24d90a23239 100644 (file)
@@ -213,6 +213,17 @@ func Test_prop_find()
   call prop_type_delete('prop_name')
 endfunc
 
+func Test_prop_find_smaller_len_than_match_col()
+  new
+  call prop_type_add('test', {'highlight': 'ErrorMsg'})
+  call setline(1, ['xxxx', 'x'])
+  call prop_add(1, 4, {'type': 'test'})
+  call assert_equal({'id': 0, 'lnum': 1, 'col': 4, 'type': 'test', 'length': 0, 'start': 1, 'end': 1},
+        \ prop_find({'type': 'test', 'lnum': 2, 'col': 1}, 'b'))
+  bwipe!
+  call prop_type_delete('test')
+endfunc
+
 func Test_prop_add()
   new
   call AddPropTypes()
index 4f5329ebb1fb23c7dbdd50659ae2cd103c973146..6e3ed5f7be80ffd32dd47e74b2a95b3bc32efadb 100644 (file)
@@ -663,13 +663,14 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
            mch_memmove(&prop, text + textlen + i * sizeof(textprop_T),
                            sizeof(textprop_T));
 
-           if (dir < 0)
-           {
-               if (col < prop.tp_col)
-                   break;
-           }
-           else if (prop.tp_col + prop.tp_len - (prop.tp_len != 0) < col)
-               continue;
+           if (lnum == lnum_start)
+               if (dir < 0)
+               {
+                   if (col < prop.tp_col)
+                       break;
+               }
+               else if (prop.tp_col + prop.tp_len - (prop.tp_len != 0) < col)
+                   continue;
 
            if (prop.tp_id == id || prop.tp_type == type_id)
            {
index 14081420373a40a5b7206524e4976e992b6c8a38..303f7eca59507e7fa16886e896d540c56ef249d1 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    378,
 /**/
     377,
 /**/