1
0
forked from aniani/vim

patch 8.2.3916: no error for passing an invalid line number to append()

Problem:    No error for passing an invalid line number to append().
Solution:   In Vim9 script check for a non-negative number. (closes #9417)
This commit is contained in:
Bram Moolenaar
2021-12-27 20:57:06 +00:00
parent 4b28ba3245
commit 8dac2acd6a
7 changed files with 31 additions and 8 deletions

View File

@@ -2130,7 +2130,11 @@ f_indent(typval_T *argvars, typval_T *rettv)
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
rettv->vval.v_number = get_indent_lnum(lnum);
else
{
if (in_vim9script())
semsg(_(e_invalid_line_number_nr), lnum);
rettv->vval.v_number = -1;
}
}
/*
@@ -2154,6 +2158,8 @@ f_lispindent(typval_T *argvars UNUSED, typval_T *rettv)
rettv->vval.v_number = get_lisp_indent();
curwin->w_cursor = pos;
}
else if (in_vim9script())
semsg(_(e_invalid_line_number_nr), lnum);
else
#endif
rettv->vval.v_number = -1;