mirror of
https://github.com/neovim/neovim.git
synced 2026-08-28 18:11:47 +00:00
fix(ui2): ensure expanded cmdline is closed after :<Esc> (#38187)
Problem: Expanded cmdline is left open after entering the cmdline again
without entering a command that emits another message (after 301c7065).
Solution: Wait for msg_show to reinstate the vim.on_key() handler.
If there was no message close the expanded cmdline.
This commit is contained in:
@@ -144,13 +144,15 @@ end
|
||||
---@param abort boolean
|
||||
function M.cmdline_hide(level, abort)
|
||||
if ui.msg.cmd_on_key then
|
||||
if abort then
|
||||
api.nvim_win_close(ui.wins.cmd, true)
|
||||
ui.check_targets()
|
||||
else
|
||||
ui.msg.set_pos('cmd')
|
||||
end
|
||||
ui.msg.cmd_on_key, M.srow = nil, 0
|
||||
-- Close expanded cmdline if command did not emit a message, keep last line.
|
||||
vim.schedule(function()
|
||||
if ui.msg.cmd_on_key == nil then
|
||||
api.nvim_win_close(ui.wins.cmd, true)
|
||||
api.nvim_buf_set_lines(ui.bufs.cmd, 0, M.erow, false, {})
|
||||
ui.check_targets()
|
||||
end
|
||||
end)
|
||||
elseif M.srow > 0 or level > (fn.getcmdwintype() == '' and 1 or 2) then
|
||||
return -- No need to hide when still in nested cmdline or cmdline_block.
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ local M = {
|
||||
delayed = false, -- Whether placement of 'last' virt_text is delayed.
|
||||
},
|
||||
dialog_on_key = nil, ---@type integer? vim.on_key namespace for paging in the dialog window.
|
||||
cmd_on_key = nil, ---@type integer? vim.on_key namespace for paging in the dialog window.
|
||||
cmd_on_key = nil, ---@type integer? vim.on_key namespace while cmdline is expanded.
|
||||
}
|
||||
|
||||
-- An external redraw indicates the start of a new batch of messages in the cmdline.
|
||||
|
||||
Reference in New Issue
Block a user