Mercurial > vim
diff src/textprop.c @ 30813:f4956427ee9e v9.0.0741
patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Commit: https://github.com/vim/vim/commit/d93009eb35c88bfc38781fefdf42ebdb02c61474
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 13 14:35:24 2022 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Oct 2022 15:45:03 +0200 |
parents | c02b74b87608 |
children | 360f286b5869 |
line wrap: on
line diff
--- a/src/textprop.c +++ b/src/textprop.c @@ -396,6 +396,9 @@ f_prop_add_list(typval_T *argvars, typva 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, typva 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; }