neovim

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

commit a62e55d407f75882a2151e552c8bd261987d174b
parent d539a952da2520bac7e0b4d4b28bf6ff53c39b7b
Author: Luuk van Baal <luukvbaal@gmail.com>
Date:   Sun, 11 May 2025 09:56:38 +0200

feat(extui): show "g<" hint when message spills 'cmdheight'

Problem:  Extui shows a spill indicator to hint to the user to press "g<"
          to show the output of the last command. The user may be
          unaware of this mapping.
Solution: Route a hint message to the message "box" window.

Diffstat:
Mruntime/lua/vim/_extui/messages.lua | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/runtime/lua/vim/_extui/messages.lua b/runtime/lua/vim/_extui/messages.lua @@ -265,13 +265,16 @@ function M.show_msg(tar, content, replace_last, more) ext.cmd.cmdline_show({}, 0, ':', '', ext.cmd.indent, 0, 0) api.nvim__redraw({ flush = true, cursor = true, win = ext.wins[ext.tab].cmd }) else - -- Place [+x] indicator for lines that spill over 'cmdheight'. - local h = api.nvim_win_text_height(ext.wins[ext.tab].cmd, {}) - M.cmd.lines, M.cmd.msg_row = h.all, h.end_row - local spill = M.cmd.lines > ext.cmdheight and ('[+%d]'):format(M.cmd.lines - ext.cmdheight) - M.virt.msg[M.virt.idx.spill][1] = spill and { 0, spill } or nil api.nvim_win_set_cursor(ext.wins[ext.tab][tar], { 1, 0 }) ext.cmd.highlighter.active[ext.bufs.cmd] = nil + -- Show hint in box and place [+x] indicator for lines that spill over 'cmdheight'. + local h = api.nvim_win_text_height(ext.wins[ext.tab].cmd, {}) + M.cmd.lines, M.cmd.msg_row = h.all, h.end_row + local spill = M.cmd.lines - ext.cmdheight + M.virt.msg[M.virt.idx.spill][1] = spill > 0 and { 0, ('[+%d]'):format(spill) } or nil + if spill > 0 then + M.msg_show('verbose', { { 0, ('Press g< to see %d more lines'):format(spill), 0 } }) + end end end