neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit db702782e0168d45256a975c4bc1809b5785d952
parent c2d218d0c645343d081f1d1901447a32e4fe4e18
Author: luukvbaal <luukvbaal@gmail.com>
Date:   Fri,  9 May 2025 23:54:39 +0200

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.
Diffstat:
Mruntime/lua/vim/_extui/messages.lua | 31++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/runtime/lua/vim/_extui/messages.lua b/runtime/lua/vim/_extui/messages.lua @@ -405,17 +405,26 @@ function M.set_pos(type) local row = (texth.all > height and texth.end_row or 0) + 1 api.nvim_win_set_cursor(ext.wins[ext.tab].box, { row, 0 }) elseif type == 'more' and api.nvim_get_current_win() ~= win then - api.nvim_create_autocmd('WinEnter', { - once = true, - callback = function() - if api.nvim_win_is_valid(win) then - api.nvim_win_set_config(win, { hide = true }) - end - append_more = 0 - end, - desc = 'Hide inactive more window.', - }) - api.nvim_set_current_win(win) + -- 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', { + once = true, + callback = function() + if api.nvim_win_is_valid(win) then + api.nvim_win_set_config(win, { hide = true }) + end + append_more = 0 + end, + desc = 'Hide inactive "more" window.', + }) + api.nvim_set_current_win(win) + end) end end