0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 9.0.0741: cannot specify an ID for each item with prop_add_list()

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)
This commit is contained in:
Bram Moolenaar
2022-10-13 14:35:24 +01:00
parent 4997f2a605
commit d93009eb35
4 changed files with 30 additions and 9 deletions

View File

@@ -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;
}