From d93009eb35c88bfc38781fefdf42ebdb02c61474 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 13 Oct 2022 14:35:24 +0100 Subject: 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) --- src/textprop.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/textprop.c') diff --git a/src/textprop.c b/src/textprop.c index 9256368125..808d1e639e 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; } -- cgit v1.2.3