diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 4aa57dda05..1beffaca48 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -5461,7 +5461,7 @@ and their respective buffers. 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. vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/lua/vim/_core/ui2.lua b/runtime/lua/vim/_core/ui2.lua index ca9e38f059..804523ba7a 100644 --- a/runtime/lua/vim/_core/ui2.lua +++ b/runtime/lua/vim/_core/ui2.lua @@ -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 diff --git a/runtime/lua/vim/_core/ui2/messages.lua b/runtime/lua/vim/_core/ui2/messages.lua index 2ed9823a20..f7bb70e7c9 100644 --- a/runtime/lua/vim/_core/ui2/messages.lua +++ b/runtime/lua/vim/_core/ui2/messages.lua @@ -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 == '' + local entered = typed == '' 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() diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index 9517d98b7d..4bc5ae186f 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -150,9 +150,8 @@ describe('messages2', function() {1:~ }|*11 foo [+1] 1,1 All| ]]) - -- Changing 'laststatus' reveals the global statusline with a pager height - -- exceeding the available lines: #38008. - command('tabonly | call nvim_echo([["foo\n"]]->repeat(&lines), 1, {})') + -- Don't enter the pager in insert mode. + command('tabonly | call nvim_echo([["foo\n"]]->repeat(&lines), 1, {}) | startinsert') screen:expect([[ ^x | {1:~ }|*5 @@ -161,12 +160,31 @@ describe('messages2', function() foo [+8] | ]]) feed('') + screen:expect([[ + | + ^x | + {1:~ }|*11 + foo [+14] 2,1 All| + ]]) + feed('') + command('call nvim_echo([["foo\n"]]->repeat(&lines), 1, {})') + screen:expect([[ + ^x | + {1:~ }|*5 + {3: }| + foo |*6 + foo [+8] | + ]]) + -- Do enter the pager in normal mode. + feed('') screen:expect([[ {3: }| ^foo | foo |*11 1,1 Top| ]]) + -- Changing 'laststatus' reveals the global statusline with a pager height + -- exceeding the available lines: #38008. command('set laststatus=3') screen:expect([[ {3: }|