diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_textprop.vim | 10 | ||||
-rw-r--r-- | src/textprop.c | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 34c719d96..39898eb4a 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -367,6 +367,16 @@ func Test_prop_add_list() \ length: 7, start: 1}], prop_list(3)) call assert_equal([#{id: 2, col: 1, type_bufnr: 0, end: 1, type: 'one', \ length: 5, start: 0}], prop_list(4)) + call prop_remove(#{id: 2}) + call assert_equal([], prop_list(1)) + + call prop_add_list(#{type: 'one', id: 3}, + \ [[1, 1, 1, 3], [2, 5, 2, 7, 9]]) + call assert_equal([#{id: 3, col: 1, type_bufnr: 0, end: 1, type: 'one', + \ length: 2, start: 1}], prop_list(1)) + call assert_equal([#{id: 9, col: 5, type_bufnr: 0, end: 1, type: 'one', + \ length: 2, start: 1}], prop_list(2)) + call assert_fails('call prop_add_list([1, 2], [[1, 1, 3]])', 'E1206:') call assert_fails('call prop_add_list({}, {})', 'E1211:') call assert_fails('call prop_add_list({}, [[1, 1, 3]])', 'E965:') diff --git a/src/textprop.c b/src/textprop.c index 925636812..808d1e639 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -396,6 +396,9 @@ f_prop_add_list(typval_T *argvars, typval_T *rettv UNUSED) end_lnum = list_find_nr(pos_list, 2L, &error); if (!error) end_col = list_find_nr(pos_list, 3L, &error); + int this_id = id; + if (!error && pos_list->lv_len > 4) + this_id = list_find_nr(pos_list, 4L, &error); if (error || start_lnum <= 0 || start_col <= 0 || end_lnum <= 0 || end_col <= 0) { @@ -403,8 +406,8 @@ f_prop_add_list(typval_T *argvars, typval_T *rettv UNUSED) emsg(_(e_invalid_argument)); return; } - if (prop_add_one(buf, type_name, id, NULL, 0, 0, start_lnum, end_lnum, - start_col, end_col) == FAIL) + if (prop_add_one(buf, type_name, this_id, NULL, 0, 0, + start_lnum, end_lnum, start_col, end_col) == FAIL) return; } diff --git a/src/version.c b/src/version.c index 3076cb0db..6570ac52a 100644 --- a/src/version.c +++ b/src/version.c @@ -700,6 +700,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 741, +/**/ 740, /**/ 739, |