0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.3919: Vim9: wrong argument for append() results in two errors

Problem:    Vim9: wrong argument for append() results in two errors.
Solution:   Check did_emsg.  Also for setline().  Adjust the help for
            appendbufline().
This commit is contained in:
Bram Moolenaar
2021-12-28 11:24:49 +00:00
parent be4e223ead
commit 8b6256f6ec
5 changed files with 39 additions and 14 deletions

View File

@@ -2249,9 +2249,10 @@ tv_get_lnum(typval_T *argvars)
if (lnum <= 0 && argvars[0].v_type != VAR_NUMBER)
{
int fnum;
pos_T *fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE);
pos_T *fp;
// no valid number, try using arg like line()
fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE);
if (fp != NULL)
lnum = fp->lnum;
}
@@ -2269,6 +2270,7 @@ tv_get_lnum_buf(typval_T *argvars, buf_T *buf)
if (argvars[0].v_type == VAR_STRING
&& argvars[0].vval.v_string != NULL
&& argvars[0].vval.v_string[0] == '$'
&& argvars[0].vval.v_string[1] == NUL
&& buf != NULL)
return buf->b_ml.ml_line_count;
return (linenr_T)tv_get_number_chk(&argvars[0], NULL);