mirror of
https://github.com/neovim/neovim.git
synced 2026-08-29 18:41:48 +00: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.
(cherry picked from commit a6ea3a1055)
This commit is contained in:
@@ -622,6 +622,12 @@ static int nlua_with(lua_State *L)
|
|||||||
int status = 0;
|
int status = 0;
|
||||||
int rets = 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;
|
const int save_min_log_level = g_min_log_level;
|
||||||
if (log_level >= 0) {
|
if (log_level >= 0) {
|
||||||
g_min_log_level = log_level;
|
g_min_log_level = log_level;
|
||||||
|
|||||||
Reference in New Issue
Block a user