Files
neovim/test/functional/legacy/tabline_spec.lua
zeertzjq 7ee1bf91ad vim-patch:9.2.0855: 'showcmd' not redrawn with empty mapping triggered on timeout
Problem:  'showcmd' not redrawn with empty mapping triggered on timeout.
Solution: Don't postpone redraw when inside vgetorpeek(). Also move test
          for tabline 'showcmd' to test_tabline.vim.

fixes:  vim/vim#20839
closes: vim/vim#20840

2e9687647a
2026-07-26 07:07:38 +08:00

101 lines
3.2 KiB
Lua

local n = require('test.functional.testnvim')()
local t = require('test.testutil')
local Screen = require('test.functional.ui.screen')
local describe, it, before_each = t.describe, t.it, t.before_each
local clear = n.clear
local exec = n.exec
local feed = n.feed
before_each(clear)
describe('tabline', function()
local screen
before_each(function()
screen = Screen.new(50, 7)
end)
-- oldtest: Test_tabline_showcmd()
it('showcmdloc=tabline works', function()
exec([[
func MyTabLine()
return '%S'
endfunc
set showcmd
set showtabline=2
set tabline=%!MyTabLine()
set showcmdloc=tabline
call setline(1, ['a', 'b', 'c'])
set foldopen+=jump
1,2fold
3
]])
feed('g')
screen:expect([[
{2:g }|
{13:+-- 2 lines: a···································}|
^c |
{1:~ }|*3
|
]])
-- typing "gg" should open the fold
feed('g')
screen:expect([[
{2: }|
^a |
b |
c |
{1:~ }|*2
|
]])
feed('<C-V>Gl')
screen:expect([[
{2:3x2 }|
{17:a} |
{17:b} |
{17:c}^ |
{1:~ }|*2
{5:-- VISUAL BLOCK --} |
]])
feed('<Esc>1234')
screen:expect([[
{2:1234 }|
a |
b |
^c |
{1:~ }|*2
|
]])
feed('<Esc>:set tabline=<CR>')
feed(':<CR>')
feed('1234')
screen:expect([[
{5: + [No Name] }{2: }{24:1234}{2: }|
a |
b |
^c |
{1:~ }|*2
: |
]])
end)
-- oldtest: Test_tabline_showcmd_redraw_tabline()
it('clears showcmd rendered by tabline redraw', function()
exec([[
set showcmd showcmdloc=tabline showtabline=2 tabline=%S timeoutlen=0
nnoremap g :redraw<CR>
nnoremap gc <Nop>
]])
feed('g')
screen:expect({ any = ':redraw', none = '{2::' })
t.eq('', n.api.nvim_eval_statusline('%S', {}).str)
end)
end)