mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 20:59:11 +00:00
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
153 lines
5.1 KiB
Lua
153 lines
5.1 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('statusline', function()
|
|
local screen
|
|
|
|
before_each(function()
|
|
screen = Screen.new(50, 7)
|
|
screen:add_extra_attr_ids({
|
|
[100] = {
|
|
background = Screen.colors.Red,
|
|
foreground = Screen.colors.Gray100,
|
|
reverse = true,
|
|
bold = true,
|
|
},
|
|
[101] = { foreground = Screen.colors.Blue, reverse = true, bold = true },
|
|
})
|
|
end)
|
|
|
|
it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function()
|
|
exec([[
|
|
setlocal statusline=-%{mode()}-
|
|
split
|
|
setlocal statusline=+%{mode()}+
|
|
]])
|
|
screen:expect([[
|
|
^ |
|
|
{1:~ }|
|
|
{3:+n+ }|
|
|
|
|
|
{1:~ }|
|
|
{2:-n- }|
|
|
|
|
|
]])
|
|
feed(':')
|
|
screen:expect([[
|
|
|
|
|
{1:~ }|
|
|
{3:+c+ }|
|
|
|
|
|
{1:~ }|
|
|
{2:-c- }|
|
|
:^ |
|
|
]])
|
|
end)
|
|
|
|
it('truncated item does not cause off-by-one highlight vim-patch:8.2.4929', function()
|
|
exec([[
|
|
set laststatus=2
|
|
hi! link User1 Directory
|
|
hi! link User2 ErrorMsg
|
|
set statusline=%.5(%1*ABC%2*DEF%1*GHI%)
|
|
]])
|
|
screen:expect([[
|
|
^ |
|
|
{1:~ }|*4
|
|
{100:<F}{101:GHI }|
|
|
|
|
|
]])
|
|
end)
|
|
|
|
-- oldtest: Test_statusline_showcmd()
|
|
it('showcmdloc=statusline works', function()
|
|
exec([[
|
|
func MyStatusLine()
|
|
return '%S'
|
|
endfunc
|
|
|
|
set showcmd
|
|
set laststatus=2
|
|
set statusline=%S
|
|
set showcmdloc=statusline
|
|
call setline(1, ['a', 'b', 'c'])
|
|
set foldopen+=jump
|
|
1,2fold
|
|
3
|
|
]])
|
|
|
|
feed('g')
|
|
screen:expect([[
|
|
{13:+-- 2 lines: a···································}|
|
|
^c |
|
|
{1:~ }|*3
|
|
{3:g }|
|
|
|
|
|
]])
|
|
|
|
-- typing "gg" should open the fold
|
|
feed('g')
|
|
screen:expect([[
|
|
^a |
|
|
b |
|
|
c |
|
|
{1:~ }|*2
|
|
{3: }|
|
|
|
|
|
]])
|
|
|
|
feed('<C-V>Gl')
|
|
screen:expect([[
|
|
{17:a} |
|
|
{17:b} |
|
|
{17:c}^ |
|
|
{1:~ }|*2
|
|
{3:3x2 }|
|
|
{5:-- VISUAL BLOCK --} |
|
|
]])
|
|
|
|
feed('<Esc>1234')
|
|
screen:expect([[
|
|
a |
|
|
b |
|
|
^c |
|
|
{1:~ }|*2
|
|
{3:1234 }|
|
|
|
|
|
]])
|
|
|
|
feed('<Esc>:set statusline=<CR>')
|
|
feed(':<CR>')
|
|
feed('1234')
|
|
screen:expect([[
|
|
a |
|
|
b |
|
|
^c |
|
|
{1:~ }|*2
|
|
{3:[No Name] [+] 1234 }|
|
|
: |
|
|
]])
|
|
end)
|
|
|
|
-- oldtest: Test_statusline_showcmd_nop_map()
|
|
it('showcmdloc=statusline is redrawn with timeout and <Nop> mapping', function()
|
|
exec([[
|
|
set timeoutlen=500 showcmd showcmdloc=statusline laststatus=2
|
|
nnoremap <space> <nop>
|
|
nnoremap <space><space> <nop>
|
|
]])
|
|
feed(' ')
|
|
screen:expect({ any = '<20>', timeout = 400 })
|
|
vim.uv.sleep(500)
|
|
screen:expect({ none = '<20>', timeout = 400 })
|
|
end)
|
|
end)
|