diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-12-27 20:57:06 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-27 20:57:06 +0000 |
commit | 8dac2acd6a79d571ff5409d9c90b4c9e73237eb4 (patch) | |
tree | 1d3712aff207fc834fb5aa8dc5afc2a394fc7788 /src/textprop.c | |
parent | 4b28ba3245df8274303c79429972f9dc9438e4aa (diff) | |
download | vim-git-8dac2acd6a79d571ff5409d9c90b4c9e73237eb4.tar.gz |
patch 8.2.3916: no error for passing an invalid line number to append()v8.2.3916
Problem: No error for passing an invalid line number to append().
Solution: In Vim9 script check for a non-negative number. (closes #9417)
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/textprop.c b/src/textprop.c index beb82a35b..b3dac1f7e 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -48,8 +48,6 @@ static hashtab_T *global_proptypes = NULL; static int proptype_id = 0; static char_u e_type_not_exist[] = N_("E971: Property type %s does not exist"); -static char_u e_invalid_col[] = N_("E964: Invalid column number: %ld"); -static char_u e_invalid_lnum[] = N_("E966: Invalid line number: %ld"); /* * Find a property type by name, return the hashitem. @@ -169,7 +167,7 @@ f_prop_add(typval_T *argvars, typval_T *rettv UNUSED) start_col = tv_get_number(&argvars[1]); if (start_col < 1) { - semsg(_(e_invalid_col), (long)start_col); + semsg(_(e_invalid_column_number_nr), (long)start_col); return; } if (argvars[2].v_type != VAR_DICT) @@ -213,12 +211,12 @@ prop_add_one( if (start_lnum < 1 || start_lnum > buf->b_ml.ml_line_count) { - semsg(_(e_invalid_lnum), (long)start_lnum); + semsg(_(e_invalid_line_number_nr), (long)start_lnum); return FAIL; } if (end_lnum < start_lnum || end_lnum > buf->b_ml.ml_line_count) { - semsg(_(e_invalid_lnum), (long)end_lnum); + semsg(_(e_invalid_line_number_nr), (long)end_lnum); return FAIL; } @@ -243,7 +241,7 @@ prop_add_one( col = 1; if (col - 1 > (colnr_T)textlen) { - semsg(_(e_invalid_col), (long)start_col); + semsg(_(e_invalid_column_number_nr), (long)start_col); return FAIL; } |