mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
fix(extui): clear cmdline buffer for first message (#34490)
Problem: Cmdline buffer is not cleared for a new message (since c973c7ae),
resulting in an incorrect spill indicator. When the cmdline
buffer is cleared, "msg_row" is not invalidated, resulting in
an error. The extui module is untested.
Return value of `vim.ui_attach()->callback` is undocumented.
Solution: Clear the cmdline buffer for the first message in an event
loop iteration. Ensure msg_row passed as end_row does not
exceed buffer length.
Add `messages_spec2.lua` to test the extui module, keeping in
mind that test coverage will greatly increase if this UI is made
the default. As such, only tests for specific extui functionality
unlikely to be covered by tests leveraging the current message grid.
Document the return value of `vim.ui_attach()->callback`, it seems
to make sense, and is also used to suppress remote UI events in
`messages_spec2.lua`.
This commit is contained in:
@@ -110,11 +110,11 @@ end
|
||||
|
||||
--- Leaving the cmdline, restore 'cmdheight' and 'ruler'.
|
||||
---
|
||||
--@param level integer
|
||||
---@param level integer
|
||||
---@param abort boolean
|
||||
function M.cmdline_hide(_, abort)
|
||||
if M.row > 0 then
|
||||
return -- No need to hide when still in cmdline_block.
|
||||
function M.cmdline_hide(level, abort)
|
||||
if M.row > 0 or level > 1 then
|
||||
return -- No need to hide when still in nested cmdline or cmdline_block.
|
||||
end
|
||||
|
||||
fn.clearmatches(ext.wins.cmd) -- Clear matchparen highlights.
|
||||
@@ -166,7 +166,7 @@ end
|
||||
--- Clear cmdline buffer and leave the cmdline.
|
||||
function M.cmdline_block_hide()
|
||||
M.row = 0
|
||||
M.cmdline_hide(nil, true)
|
||||
M.cmdline_hide(M.level, true)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user