fix(ui2): entering the pager fails if <ESC> is remapped to :fclose (#39462)

Problem:  Entering the pager fails if <ESC> is remapped to :fclose by user.
Solution: Avoid executing mappings with nvim_feedkeys() that closes expanded cmdline.
This commit is contained in:
Tomasz N
2026-05-06 15:42:26 +02:00
committed by GitHub
parent c3f803c3b6
commit 2b7a00746d
2 changed files with 2 additions and 1 deletions

View File

@@ -600,7 +600,7 @@ local function enter_pager()
if was_cmdwin ~= '' then
api.nvim_command('quit')
elseif M.cmd_on_key then
api.nvim_feedkeys(vim.keycode('<Esc>'), 't', false)
api.nvim_feedkeys(vim.keycode('<Esc>'), 'tn', false)
end
-- Cmdwin is closed one event iteration later so schedule in case it was open.
vim.schedule(function()

View File

@@ -180,6 +180,7 @@ describe('messages2', function()
foo [+9] |
]])
-- Do enter the pager in normal mode.
command('nmap <Esc> <Cmd>fclose<CR>')
feed('<CR>')
screen:expect([[
^foo |