mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 10:56:31 +00:00
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:
@@ -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);
|
||||||
|
Reference in New Issue
Block a user