From 62a0c9f8c24b9115155cd4551976353ace3e2c5e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 10 Oct 2022 23:28:09 +0800 Subject: 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) https://github.com/vim/vim/commit/801cd35e7e3b21e519e12a1610ee1d721e40893e Skip test as it depends on too many previous patches. --- src/nvim/eval/typval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index ead86757b3..a0b06aaaf4 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -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) 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); - if (lnum <= 0 && tv->v_type != VAR_NUMBER) { + if (lnum <= 0 && did_emsg_before == did_emsg && tv->v_type != VAR_NUMBER) { int fnum; // No valid number, try using same function as line() does. pos_T *const fp = var2fpos(tv, true, &fnum, false); -- cgit