mirror of
https://github.com/neovim/neovim.git
synced 2025-11-07 03:04:22 +00:00
fix(extui): close cmdwin to enter "more" window (#33860)
Problem: Cannot enter "more" window while cmdwin is open since it is a
regular window and changing windows is disallowed.
Solution: Close cmdwin to enter the "more" window. Minor regression
w.r.t. the current message grid. Resolving that will require
somehow bypassing textlock for the "more" window.
This commit is contained in:
@@ -405,6 +405,14 @@ function M.set_pos(type)
|
|||||||
local row = (texth.all > height and texth.end_row or 0) + 1
|
local row = (texth.all > height and texth.end_row or 0) + 1
|
||||||
api.nvim_win_set_cursor(ext.wins[ext.tab].box, { row, 0 })
|
api.nvim_win_set_cursor(ext.wins[ext.tab].box, { row, 0 })
|
||||||
elseif type == 'more' and api.nvim_get_current_win() ~= win then
|
elseif type == 'more' and api.nvim_get_current_win() ~= win then
|
||||||
|
-- Cannot leave the cmdwin to enter the "more" window, so close it.
|
||||||
|
-- NOTE: regression w.r.t. the message grid, which allowed this. Resolving
|
||||||
|
-- that would require somehow bypassing textlock for the "more" window.
|
||||||
|
if fn.getcmdwintype() ~= '' then
|
||||||
|
api.nvim_command('quit')
|
||||||
|
end
|
||||||
|
-- It's actually closed one event iteration later so schedule in case it was open.
|
||||||
|
vim.schedule(function()
|
||||||
api.nvim_create_autocmd('WinEnter', {
|
api.nvim_create_autocmd('WinEnter', {
|
||||||
once = true,
|
once = true,
|
||||||
callback = function()
|
callback = function()
|
||||||
@@ -413,9 +421,10 @@ function M.set_pos(type)
|
|||||||
end
|
end
|
||||||
append_more = 0
|
append_more = 0
|
||||||
end,
|
end,
|
||||||
desc = 'Hide inactive more window.',
|
desc = 'Hide inactive "more" window.',
|
||||||
})
|
})
|
||||||
api.nvim_set_current_win(win)
|
api.nvim_set_current_win(win)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user