mirror of
https://github.com/neovim/neovim.git
synced 2025-12-17 20:05:38 +00:00
fix(extui): ensure windows are valid in scheduled on_key (#35106)
This commit is contained in:
@@ -491,9 +491,12 @@ function M.set_pos(type)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
|
if api.nvim_win_is_valid(win) then
|
||||||
api.nvim_win_set_config(win, save_config)
|
api.nvim_win_set_config(win, save_config)
|
||||||
|
end
|
||||||
cmd_on_key = nil
|
cmd_on_key = nil
|
||||||
local entered = api.nvim_get_current_win() == win
|
local entered = api.nvim_get_current_win() == win
|
||||||
|
ext.check_targets()
|
||||||
-- Show or clear the message depending on if the pager was opened.
|
-- Show or clear the message depending on if the pager was opened.
|
||||||
if entered or not api.nvim_win_get_config(ext.wins.pager).hide then
|
if entered or not api.nvim_win_get_config(ext.wins.pager).hide then
|
||||||
M.virt.msg[M.virt.idx.spill][1] = nil
|
M.virt.msg[M.virt.idx.spill][1] = nil
|
||||||
@@ -502,6 +505,7 @@ function M.set_pos(type)
|
|||||||
api.nvim_command('norm! g<') -- User entered the cmdline window: open the pager.
|
api.nvim_command('norm! g<') -- User entered the cmdline window: open the pager.
|
||||||
end
|
end
|
||||||
elseif ext.cfg.msg.target == 'cmd' and ext.cmd.level <= 0 then
|
elseif ext.cfg.msg.target == 'cmd' and ext.cmd.level <= 0 then
|
||||||
|
ext.check_targets()
|
||||||
set_virttext('msg')
|
set_virttext('msg')
|
||||||
end
|
end
|
||||||
api.nvim__redraw({ flush = true }) -- NOTE: redundant unless cmdline was opened.
|
api.nvim__redraw({ flush = true }) -- NOTE: redundant unless cmdline was opened.
|
||||||
|
|||||||
@@ -217,4 +217,21 @@ describe('messages2', function()
|
|||||||
{9:E354: Invalid register name: '^@'} |
|
{9:E354: Invalid register name: '^@'} |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('hit-enter prompt does not error for invalid window #35095', function()
|
||||||
|
command('echo "foo\nbar"')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
{1:~ }|*10
|
||||||
|
{3:─────────────────────────────────────────────────────}|
|
||||||
|
foo |
|
||||||
|
bar |
|
||||||
|
]])
|
||||||
|
feed('<C-w>o')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
{1:~ }|*12
|
||||||
|
foo [+1] |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user