summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/testdir/test_textprop.vim11
-rw-r--r--src/textprop.c15
-rw-r--r--src/version.c2
3 files changed, 21 insertions, 7 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 6d3aaa3be..692b0c4bd 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -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()
diff --git a/src/textprop.c b/src/textprop.c
index 4f5329ebb..6e3ed5f7b 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -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)
{
diff --git a/src/version.c b/src/version.c
index 140814203..303f7eca5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 378,
+/**/
377,
/**/
376,