vim-patch:partial:9.0.0715: wrong argument for append() gives two error messages

Problem:    Wrong argument for append() gives two error messages.
Solution:   When getting an error for a number argument don't try using it as
            a string. (closes vim/vim#11335)
801cd35e7e

Skip test as it depends on too many previous patches.
This commit is contained in:
zeertzjq
2022-10-10 23:28:09 +08:00
parent 2cc64dca92
commit 62a0c9f8c2

View File

@@ -3750,8 +3750,9 @@ varnumber_T tv_get_number_chk(const typval_T *const tv, bool *const ret_error)
linenr_T tv_get_lnum(const typval_T *const tv) linenr_T tv_get_lnum(const typval_T *const tv)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{ {
const int did_emsg_before = did_emsg;
linenr_T lnum = (linenr_T)tv_get_number_chk(tv, NULL); linenr_T lnum = (linenr_T)tv_get_number_chk(tv, NULL);
if (lnum <= 0 && tv->v_type != VAR_NUMBER) { if (lnum <= 0 && did_emsg_before == did_emsg && tv->v_type != VAR_NUMBER) {
int fnum; int fnum;
// No valid number, try using same function as line() does. // No valid number, try using same function as line() does.
pos_T *const fp = var2fpos(tv, true, &fnum, false); pos_T *const fp = var2fpos(tv, true, &fnum, false);