mirror of
https://github.com/neovim/neovim.git
synced 2026-04-05 07:09:23 +00:00
fix(ui2): ENTER may focus pager in insert/terminal mode #38497
fix(ui2): prevent <CR> from focusing pager in insert/terminal mode
Problem: <CR> in insert/terminal mode can focus pager unexpectedly.
Solution: Don't enter the pager when <CR> is pressed during expanded
cmdline in insert/terminal mode.
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
--- Unlike the legacy |hit-enter| prompt, messages exceeding 'cmdheight' are
|
||||
--- instead "collapsed", followed by a `[+x]` "spill" indicator, where `x`
|
||||
--- indicates the spilled lines. To see the full messages, do either:
|
||||
--- - ENTER immediately after a message from interactive |:| cmdline.
|
||||
--- - ENTER while cmdline is expanded (not in |Insert-mode| and |Terminal-mode|).
|
||||
--- - |g<| at any time.
|
||||
|
||||
local api = vim.api
|
||||
|
||||
@@ -517,7 +517,7 @@ local cmd_on_key = function(_, typed)
|
||||
M.cmd_on_key, M.cmd.ids = nil, {}
|
||||
|
||||
-- Check if window was entered and reopen with original config.
|
||||
local entered = typed == '<CR>'
|
||||
local entered = typed == '<CR>' and not api.nvim_get_mode().mode:match('[it]')
|
||||
or typed:find('LeftMouse') and fn.getmousepos().winid == ui.wins.cmd
|
||||
pcall(api.nvim_win_close, ui.wins.cmd, true)
|
||||
ui.check_targets()
|
||||
|
||||
Reference in New Issue
Block a user