mirror of
https://github.com/neovim/neovim.git
synced 2026-05-06 08:26:45 -04:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user