mirror of
https://github.com/neovim/neovim.git
synced 2026-07-17 14:41:33 +00:00
fix(ui2): clear showcmd virt_text together with search count
Problem: when the search count is displayed, the showcmd virt_text is set to 11 empty spaces to ensure a consistent distance between search count and ruler, or screen edge in case of noruler. But when the search count is removed to make place for a message, the empty dummy showcmd remains and unnecessarily erases part of the message. Solution: properly remove showcmd together with search count.
This commit is contained in:
@@ -462,6 +462,7 @@ function M.msg_show(kind, content, replace_last, _, append, id, trigger)
|
||||
M.cmd.last_emsg = (kind == 'emsg' or kind == 'wmsg') and os.time() or M.cmd.last_emsg
|
||||
-- Should clear the search count now, mark itself is cleared by invalidate.
|
||||
M.virt.last[M.virt.idx.search][1] = nil
|
||||
M.virt.last[M.virt.idx.cmd] = {}
|
||||
end
|
||||
-- When message was emitted below an already expanded cmdline, move and route to pager.
|
||||
tgt = ui.cmd.expand > 0 and 'pager' or tgt
|
||||
|
||||
@@ -1092,14 +1092,15 @@ describe('messages2', function()
|
||||
end)
|
||||
|
||||
it('search count is cleared', function()
|
||||
command('set ruler shortmess-=S | call setline(1, ["foo", "bar"])')
|
||||
command('set ruler showcmd shortmess-=S | call setline(1, ["foo", "bar"])')
|
||||
feed('/foo<CR>')
|
||||
screen:expect([[
|
||||
local search_count = [[
|
||||
{10:^foo} |
|
||||
bar |
|
||||
{1:~ }|*11
|
||||
/foo W [1/1] 1,1 All|
|
||||
]])
|
||||
]]
|
||||
screen:expect(search_count)
|
||||
feed('<C-L>j')
|
||||
screen:expect([[
|
||||
{10:foo} |
|
||||
@@ -1107,5 +1108,14 @@ describe('messages2', function()
|
||||
{1:~ }|*11
|
||||
2,1 All|
|
||||
]])
|
||||
feed('n')
|
||||
screen:expect(search_count)
|
||||
command('echo "-"->repeat(&columns)')
|
||||
screen:expect([[
|
||||
{10:^foo} |
|
||||
bar |
|
||||
{1:~ }|*11
|
||||
-----------------------------------1,1 All|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user