diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/vimscript.c | 14 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 7 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c index 99ab247c2a..4b4404ea09 100644 --- a/src/nvim/api/vimscript.c +++ b/src/nvim/api/vimscript.c @@ -1241,10 +1241,12 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Error } if (HAS_KEY(mods.verbose)) { - if (mods.verbose.type != kObjectTypeInteger || mods.verbose.data.integer <= 0) { - VALIDATION_ERROR("'mods.verbose' must be a non-negative Integer"); + if (mods.verbose.type != kObjectTypeInteger) { + VALIDATION_ERROR("'mods.verbose' must be a Integer"); + } else if (mods.verbose.data.integer >= 0) { + // Silently ignore negative integers to allow mods.verbose to be set to -1. + cmdinfo.verbose = mods.verbose.data.integer; } - cmdinfo.verbose = mods.verbose.data.integer; } bool vertical; @@ -1256,8 +1258,10 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Error VALIDATION_ERROR("'mods.split' must be a String"); } - if (STRCMP(mods.split.data.string.data, "aboveleft") == 0 - || STRCMP(mods.split.data.string.data, "leftabove") == 0) { + if (*mods.split.data.string.data == NUL) { + // Empty string, do nothing. + } else if (STRCMP(mods.split.data.string.data, "aboveleft") == 0 + || STRCMP(mods.split.data.string.data, "leftabove") == 0) { cmdinfo.cmdmod.split |= WSP_ABOVE; } else if (STRCMP(mods.split.data.string.data, "belowright") == 0 || STRCMP(mods.split.data.string.data, "rightbelow") == 0) { diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index deff2347e0..3ba4d0d70c 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1919,7 +1919,8 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview) lua_pushinteger(lstate, cmdmod.tab); lua_setfield(lstate, -2, "tab"); - lua_pushinteger(lstate, p_verbose); + + lua_pushinteger(lstate, eap->verbose_save != -1 ? p_verbose : -1); lua_setfield(lstate, -2, "verbose"); if (cmdmod.split & WSP_ABOVE) { @@ -1937,9 +1938,9 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview) lua_pushboolean(lstate, cmdmod.split & WSP_VERT); lua_setfield(lstate, -2, "vertical"); - lua_pushboolean(lstate, msg_silent != 0); + lua_pushboolean(lstate, eap->save_msg_silent != -1 ? (msg_silent != 0) : 0); lua_setfield(lstate, -2, "silent"); - lua_pushboolean(lstate, emsg_silent != 0); + lua_pushboolean(lstate, eap->did_esilent); lua_setfield(lstate, -2, "emsg_silent"); lua_pushboolean(lstate, eap->did_sandbox); lua_setfield(lstate, -2, "sandbox"); |