-*textprop.txt* For Vim version 9.1. Last change: 2024 Jun 08
+*textprop.txt* For Vim version 9.1. Last change: 2024 Sep 08
VIM REFERENCE MANUAL by Bram Moolenaar
bufnr buffer to add the property to; when omitted
the current buffer is used
id user defined ID for the property; must be a
- number, should be positive; when using "text"
- then "id" must not be present and will be set
- automatically to a negative number; otherwise
- zero is used
+ number, should be positive |E1510|;
+ when using "text" then "id" must not be
+ present and will be set automatically to a
+ negative number; otherwise zero is used
*E1305*
text text to be displayed before {col}, or
above/below the line if {col} is zero; prepend
call prop_add_list(#{type: 'MyProp', id: 2},
\ [[1, 4, 1, 7],
\ [1, 15, 1, 20],
- \ [2, 30, 3, 30]]
+ \ [2, 30, 3, 30]])
<
Can also be used as a |method|: >
GetProp()->prop_add_list([[1, 1, 1, 2], [1, 4, 1, 8]])
call assert_fails('call prop_add_list(test_null_dict(), [[2, 2, 2]])', 'E965:')
call assert_fails('call prop_add_list(#{type: "one"}, test_null_list())', 'E1298:')
call assert_fails('call prop_add_list(#{type: "one"}, [test_null_list()])', 'E714:')
+ call assert_fails('call prop_add_list(#{type: "one", id: 2147483648}, [[2, 2, 2, 2], [3, 20, 3, 22]])', 'E1510:')
+ call assert_fails('call prop_add_list(#{type: "one", id: -2147483648}, [[2, 2, 2, 2], [3, 20, 3, 22]])', 'E1510:')
" only one error for multiple wrong values
call assert_fails('call prop_add_list(#{type: "one"}, [[{}, [], 0z00, 0.3]])', ['E728:', 'E728:'])
call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'length':-1})", 'E475:')
call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'end_col':0})", 'E475:')
call assert_fails("call prop_add(2, 3, {'length':1})", 'E965:')
+ call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'id': 2147483648})", 'E1510:')
+ call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'id': -2147483648})", 'E1510:')
call prop_type_delete('xxx')
bwipe!
type_name = dict_get_string(dict, "type", FALSE);
if (dict_has_key(dict, "id"))
- id = dict_get_number(dict, "id");
+ {
+ vimlong_T x;
+ x = dict_get_number(dict, "id");
+ if (x > INT_MAX || x <= INT_MIN)
+ {
+ semsg(_(e_val_too_large), dict_get_string(dict, "id", FALSE));
+ return;
+ }
+ id = (int)x;
+ }
if (get_bufnr_from_arg(&argvars[0], &buf) == FAIL)
return;
end_col = 1;
if (dict_has_key(dict, "id"))
- id = dict_get_number(dict, "id");
+ {
+ vimlong_T x;
+ x = dict_get_number(dict, "id");
+ if (x > INT_MAX || x <= INT_MIN)
+ {
+ semsg(_(e_val_too_large), dict_get_string(dict, "id", FALSE));
+ goto theend;
+ }
+ id = (int)x;
+ }
if (dict_has_key(dict, "text"))
{
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 722,
/**/
721,
/**/