diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-10-13 14:35:24 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-10-13 14:35:24 +0100 |
commit | d93009eb35c88bfc38781fefdf42ebdb02c61474 (patch) | |
tree | 0db02d04485459b9901d01952385c63b1e23137e /src/textprop.c | |
parent | 4997f2a605e15261c4f825494324371f271ef6a8 (diff) | |
download | vim-git-d93009eb35c88bfc38781fefdf42ebdb02c61474.tar.gz |
patch 9.0.0741: cannot specify an ID for each item with prop_add_list()v9.0.0741
Problem: Cannot specify an ID for each item with prop_add_list(). (Sergey
Vlasov)
Solution: Add an optional fifth number to the item. (closes #11360)
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; } |