diff options
| author | altermo <107814000+altermo@users.noreply.github.com> | 2026-05-01 16:33:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-01 10:33:45 -0400 |
| commit | a6ea3a1055a374df36cb037ec548698cd9f56fbd (patch) | |
| tree | 1f3a540a9d1ed01a2dbc8522b0e7fa14a2528cfb /src/nvim/lua | |
| parent | ad2cf234352d276461a5ce9e8db58cd4cd628ee4 (diff) | |
| download | rneovim-a6ea3a1055a374df36cb037ec548698cd9f56fbd.tar.gz rneovim-a6ea3a1055a374df36cb037ec548698cd9f56fbd.tar.bz2 rneovim-a6ea3a1055a374df36cb037ec548698cd9f56fbd.zip | |
fix: vim._with may silence all cmdline-errors #34301
Problem:
vim._with may silence all cmdline-errors if emsg_silent=true, silent=false.
Steps to reproduce:
`nvim --clean -u repro.lua`, then `:echoerr 123`, nothing is shown.
local api, fn = vim.api, vim.fn
-- api.nvim_create_autocmd("CursorMovedC", {
api.nvim_create_autocmd("CmdlineChanged", {
callback = function(args)
if args.match ~= ":" then
return
end
-- vim.cmd([[silent! ]])
vim._with({ emsg_silent = true }, function()
-- return api.nvim_parse_cmd(fn.getcmdline(), {})
end)
end,
})
Solution:
Force CMOD_SILENT if CMOD_ERRSILENT.
Diffstat (limited to 'src/nvim/lua')
| -rw-r--r-- | src/nvim/lua/stdlib.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c index 1b36da4fbb..c2e8394154 100644 --- a/src/nvim/lua/stdlib.c +++ b/src/nvim/lua/stdlib.c @@ -622,6 +622,12 @@ static int nlua_with(lua_State *L) int status = 0; int rets = 0; + if (flags & CMOD_ERRSILENT) { + // CMOD_ERRSILENT must imply CMOD_SILENT, otherwise apply_cmdmod() and undo_cmdmod() won't + // work properly. + flags |= CMOD_SILENT; + } + const int save_min_log_level = g_min_log_level; if (log_level >= 0) { g_min_log_level = log_level; |