2024-04-20 08:44:13 -07:00
|
|
|
local t = require('test.testutil')
|
|
|
|
local n = require('test.functional.testnvim')()
|
2022-05-23 06:11:24 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2024-04-20 08:44:13 -07:00
|
|
|
|
|
|
|
local assert_alive = n.assert_alive
|
|
|
|
local clear = n.clear
|
|
|
|
local command = n.command
|
|
|
|
local feed = n.feed
|
2024-04-08 02:03:20 -07:00
|
|
|
local eq = t.eq
|
2024-04-20 08:44:13 -07:00
|
|
|
local fn = n.fn
|
|
|
|
local api = n.api
|
|
|
|
local exec = n.exec
|
|
|
|
local exec_lua = n.exec_lua
|
|
|
|
local eval = n.eval
|
2024-01-12 04:41:09 -07:00
|
|
|
local sleep = vim.uv.sleep
|
2024-04-08 02:03:20 -07:00
|
|
|
local pcall_err = t.pcall_err
|
2022-05-23 06:11:24 -07:00
|
|
|
|
2023-04-24 20:05:04 -07:00
|
|
|
local mousemodels = { 'extend', 'popup', 'popup_setpos' }
|
|
|
|
|
|
|
|
for _, model in ipairs(mousemodels) do
|
|
|
|
describe('statusline clicks with mousemodel=' .. model, function()
|
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new(40, 8)
|
2023-06-28 20:18:56 -07:00
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
|
|
|
[1] = { bold = true, reverse = true }, -- StatusLine
|
2024-10-12 10:57:31 -07:00
|
|
|
[2] = { bold = true, foreground = Screen.colors.Blue, reverse = true }, -- NonText combined with StatusLine
|
2023-06-28 20:18:56 -07:00
|
|
|
})
|
2023-04-24 20:05:04 -07:00
|
|
|
screen:attach()
|
|
|
|
command('set laststatus=2 mousemodel=' .. model)
|
|
|
|
exec([=[
|
|
|
|
function! MyClickFunc(minwid, clicks, button, mods)
|
|
|
|
let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button)
|
|
|
|
if a:mods !=# ' '
|
|
|
|
let g:testvar ..= '(' .. a:mods .. ')'
|
|
|
|
endif
|
|
|
|
endfunction
|
2023-06-28 20:18:56 -07:00
|
|
|
let g:testvar = ''
|
2023-04-24 20:05:04 -07:00
|
|
|
]=])
|
2023-06-28 20:18:56 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {})
|
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 16)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 29)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 2 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 3 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 4 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 28)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 28)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 2 r', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 28)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 3 r', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 28)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 4 r', eval('g:testvar'))
|
2024-10-04 06:31:28 -07:00
|
|
|
api.nvim_input_mouse('x1', 'press', '', 0, 6, 17)
|
|
|
|
eq('0 1 x1', eval('g:testvar'))
|
|
|
|
api.nvim_input_mouse('x1', 'press', '', 0, 6, 17)
|
|
|
|
eq('0 2 x1', eval('g:testvar'))
|
|
|
|
api.nvim_input_mouse('x1', 'press', '', 0, 6, 17)
|
|
|
|
eq('0 3 x1', eval('g:testvar'))
|
|
|
|
api.nvim_input_mouse('x1', 'press', '', 0, 6, 17)
|
|
|
|
eq('0 4 x1', eval('g:testvar'))
|
|
|
|
api.nvim_input_mouse('x2', 'press', '', 0, 6, 28)
|
|
|
|
eq('0 1 x2', eval('g:testvar'))
|
|
|
|
api.nvim_input_mouse('x2', 'press', '', 0, 6, 28)
|
|
|
|
eq('0 2 x2', eval('g:testvar'))
|
|
|
|
api.nvim_input_mouse('x2', 'press', '', 0, 6, 28)
|
|
|
|
eq('0 3 x2', eval('g:testvar'))
|
|
|
|
api.nvim_input_mouse('x2', 'press', '', 0, 6, 28)
|
|
|
|
eq('0 4 x2', eval('g:testvar'))
|
2023-06-28 20:18:56 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with control characters and highlight', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('statusline', '\t%#NonText#\1%0@MyClickFunc@\t\1%T\t%##\1', {})
|
2023-06-28 20:18:56 -07:00
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2024-10-12 10:57:31 -07:00
|
|
|
{1:^I}{2:^A^I^A^I}{1:^A }|
|
2023-06-28 20:18:56 -07:00
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 3)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 8)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 4)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 7)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works for winbar', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {})
|
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 0, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 0, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r', eval('g:testvar'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works for winbar in floating window', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_open_win(
|
2023-06-28 20:18:56 -07:00
|
|
|
0,
|
|
|
|
true,
|
|
|
|
{ width = 30, height = 4, relative = 'editor', row = 1, col = 5, border = 'single' }
|
|
|
|
)
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value(
|
2023-06-28 20:18:56 -07:00
|
|
|
'winbar',
|
|
|
|
'Not clicky stuff %0@MyClickFunc@Clicky stuff%T',
|
|
|
|
{ scope = 'local' }
|
|
|
|
)
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 2, 23)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works when there are multiple windows', function()
|
|
|
|
command('split')
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {})
|
|
|
|
api.nvim_set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {})
|
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 0, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 4, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('middle', 'press', '', 0, 3, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 m', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with Lua function', function()
|
|
|
|
exec_lua([[
|
|
|
|
function clicky_func(minwid, clicks, button, mods)
|
|
|
|
vim.g.testvar = string.format("%d %d %s", minwid, clicks, button)
|
|
|
|
end
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value(
|
2023-06-28 20:18:56 -07:00
|
|
|
'statusline',
|
|
|
|
'Not clicky stuff %0@v:lua.clicky_func@Clicky stuff%T',
|
|
|
|
{}
|
|
|
|
)
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('ignores unsupported click items', function()
|
|
|
|
command('tabnew | tabprevious')
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('statusline', '%2TNot clicky stuff%T', {})
|
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 0)
|
2024-01-16 06:26:21 -07:00
|
|
|
eq(1, api.nvim_get_current_tabpage())
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('statusline', '%2XNot clicky stuff%X', {})
|
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 0)
|
|
|
|
eq(2, #api.nvim_list_tabpages())
|
2023-06-28 20:18:56 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it("right click works when statusline isn't focused #18994", function()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {})
|
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 2 r', eval('g:testvar'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with modifiers #18994', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T', {})
|
2023-06-28 20:18:56 -07:00
|
|
|
-- Note: alternate between left and right mouse buttons to avoid triggering multiclicks
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', 'S', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l(s )', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', 'S', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r(s )', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', 'A', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l( a )', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', 'A', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r( a )', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', 'AS', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l(s a )', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', 'AS', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r(s a )', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', 'T', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l( m)', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', 'T', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r( m)', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', 'TS', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l(s m)', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', 'TS', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r(s m)', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', 'C', 0, 6, 17)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l( c )', eval('g:testvar'))
|
|
|
|
-- <C-RightMouse> is for tag jump
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works for global statusline with vertical splits #19186', function()
|
|
|
|
command('set laststatus=3')
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value(
|
2023-06-28 20:18:56 -07:00
|
|
|
'statusline',
|
|
|
|
'%0@MyClickFunc@Clicky stuff%T %= %0@MyClickFunc@Clicky stuff%T',
|
|
|
|
{}
|
|
|
|
)
|
|
|
|
command('vsplit')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
2023-04-24 20:05:04 -07:00
|
|
|
^ │ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }│{0:~ }|*5
|
2023-06-28 20:18:56 -07:00
|
|
|
{1:Clicky stuff Clicky stuff}|
|
2023-04-24 20:05:04 -07:00
|
|
|
|
|
2023-06-28 20:18:56 -07:00
|
|
|
]],
|
|
|
|
}
|
|
|
|
|
|
|
|
-- clickable area on the right
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 35)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 35)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r', eval('g:testvar'))
|
|
|
|
|
|
|
|
-- clickable area on the left
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 5)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 5)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r', eval('g:testvar'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('no memory leak with zero-width click labels', function()
|
|
|
|
command([[
|
|
|
|
let &stl = '%@Test@%T%@MyClickFunc@%=%T%@Test@'
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 0)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('right', 'press', '', 0, 6, 39)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 r', eval('g:testvar'))
|
2023-04-24 20:05:04 -07:00
|
|
|
end)
|
2023-06-28 20:18:56 -07:00
|
|
|
|
|
|
|
it('no memory leak with truncated click labels', function()
|
|
|
|
command([[
|
|
|
|
let &stl = '%@MyClickFunc@foo%X' .. repeat('a', 40) .. '%<t%@Test@bar%X%@Test@baz'
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 6, 2)
|
2023-06-28 20:18:56 -07:00
|
|
|
eq('0 1 l', eval('g:testvar'))
|
|
|
|
end)
|
|
|
|
end)
|
2023-04-24 20:05:04 -07:00
|
|
|
end
|
2022-05-23 06:11:24 -07:00
|
|
|
|
|
|
|
describe('global statusline', function()
|
|
|
|
local screen
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
screen = Screen.new(60, 16)
|
|
|
|
screen:attach()
|
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[1] = { bold = true, foreground = Screen.colors.Blue },
|
|
|
|
[2] = { bold = true, reverse = true },
|
|
|
|
[3] = { bold = true },
|
|
|
|
[4] = { reverse = true },
|
2022-10-06 17:52:51 -07:00
|
|
|
[5] = { bold = true, foreground = Screen.colors.Fuchsia },
|
2022-05-23 06:11:24 -07:00
|
|
|
})
|
|
|
|
command('set laststatus=3')
|
|
|
|
command('set ruler')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works', function()
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*13
|
2022-05-23 06:11:24 -07:00
|
|
|
{2:[No Name] 0,0-1 All}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
feed('i<CR><CR>')
|
|
|
|
screen:expect([[
|
2023-12-09 05:42:00 -07:00
|
|
|
|*2
|
2022-05-23 06:11:24 -07:00
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*11
|
2022-05-23 06:11:24 -07:00
|
|
|
{2:[No Name] [+] 3,1 All}|
|
|
|
|
{3:-- INSERT --} |
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works with splits', function()
|
|
|
|
command('vsplit | split | vsplit | vsplit | wincmd l | split | 2wincmd l | split')
|
|
|
|
screen:expect([[
|
|
|
|
│ │ │^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{1:~ }├────────────────┤{1:~}│{1:~ }|
|
|
|
|
{1:~ }│ │{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}├────────────────────|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│ |
|
|
|
|
────────────────────┴────────────────┴─┤{1:~ }|
|
|
|
|
│{1:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{2:[No Name] 0,0-1 All}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works when switching between values of laststatus', function()
|
|
|
|
command('set laststatus=1')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*14
|
2022-05-23 06:11:24 -07:00
|
|
|
0,0-1 All |
|
|
|
|
]])
|
|
|
|
|
|
|
|
command('set laststatus=3')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*13
|
2022-05-23 06:11:24 -07:00
|
|
|
{2:[No Name] 0,0-1 All}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
command('vsplit | split | vsplit | vsplit | wincmd l | split | 2wincmd l | split')
|
|
|
|
command('set laststatus=2')
|
|
|
|
screen:expect([[
|
|
|
|
│ │ │^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{1:~ }│{4:< Name] 0,0-1 }│{1:~}│{1:~ }|
|
|
|
|
{1:~ }│ │{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│{2:<No Name] 0,0-1 All}|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│ |
|
|
|
|
{4:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }|
|
|
|
|
│{1:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{4:[No Name] 0,0-1 All <No Name] 0,0-1 All}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
command('set laststatus=3')
|
|
|
|
screen:expect([[
|
|
|
|
│ │ │^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{1:~ }├────────────────┤{1:~}│{1:~ }|
|
|
|
|
{1:~ }│ │{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}├────────────────────|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│ |
|
|
|
|
────────────────────┴────────────────┴─┤{1:~ }|
|
|
|
|
│{1:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{2:[No Name] 0,0-1 All}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
command('set laststatus=0')
|
|
|
|
screen:expect([[
|
|
|
|
│ │ │^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{1:~ }│{4:< Name] 0,0-1 }│{1:~}│{1:~ }|
|
|
|
|
{1:~ }│ │{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│{2:<No Name] 0,0-1 All}|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│ |
|
|
|
|
{4:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }|
|
|
|
|
│{1:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*4
|
2022-05-23 06:11:24 -07:00
|
|
|
0,0-1 All |
|
|
|
|
]])
|
|
|
|
|
|
|
|
command('set laststatus=3')
|
|
|
|
screen:expect([[
|
|
|
|
│ │ │^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{1:~ }├────────────────┤{1:~}│{1:~ }|
|
|
|
|
{1:~ }│ │{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│{1:~ }|
|
|
|
|
{1:~ }│{1:~ }│{1:~}├────────────────────|
|
|
|
|
{1:~ }│{1:~ }│{1:~}│ |
|
|
|
|
────────────────────┴────────────────┴─┤{1:~ }|
|
|
|
|
│{1:~ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*3
|
2022-05-23 06:11:24 -07:00
|
|
|
{2:[No Name] 0,0-1 All}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('win_move_statusline() can reduce cmdheight to 1', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
eq(1, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
fn.win_move_statusline(0, -1)
|
|
|
|
eq(2, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
fn.win_move_statusline(0, -1)
|
|
|
|
eq(3, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
fn.win_move_statusline(0, 1)
|
|
|
|
eq(2, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
fn.win_move_statusline(0, 1)
|
|
|
|
eq(1, api.nvim_get_option_value('cmdheight', {}))
|
2022-05-23 06:11:24 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('mouse dragging can reduce cmdheight to 1', function()
|
|
|
|
command('set mouse=a')
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_input_mouse('left', 'press', '', 0, 14, 10)
|
|
|
|
eq(1, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 13, 10)
|
|
|
|
eq(2, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 12, 10)
|
|
|
|
eq(3, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 13, 10)
|
|
|
|
eq(2, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 14, 10)
|
|
|
|
eq(1, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 15, 10)
|
|
|
|
eq(1, api.nvim_get_option_value('cmdheight', {}))
|
|
|
|
api.nvim_input_mouse('left', 'drag', '', 0, 14, 10)
|
|
|
|
eq(1, api.nvim_get_option_value('cmdheight', {}))
|
2022-05-23 06:11:24 -07:00
|
|
|
end)
|
2022-10-06 17:52:51 -07:00
|
|
|
|
|
|
|
it('cmdline row is correct after setting cmdheight #20514', function()
|
|
|
|
command('botright split test/functional/fixtures/bigfile.txt')
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('cmdheight', 1, {})
|
2022-10-06 17:52:51 -07:00
|
|
|
feed('L')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*5
|
2022-10-06 17:52:51 -07:00
|
|
|
────────────────────────────────────────────────────────────|
|
|
|
|
0000;<control>;Cc;0;BN;;;;;N;NULL;;;; |
|
|
|
|
0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;; |
|
|
|
|
0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
|
|
|
|
0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
|
|
|
|
0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; |
|
|
|
|
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
|
|
|
|
^0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
|
|
|
|
{2:test/functional/fixtures/bigfile.txt 7,1 Top}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('j')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*5
|
2022-10-06 17:52:51 -07:00
|
|
|
────────────────────────────────────────────────────────────|
|
|
|
|
0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;; |
|
|
|
|
0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
|
|
|
|
0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
|
|
|
|
0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; |
|
|
|
|
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
|
|
|
|
0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
|
|
|
|
^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
|
|
|
|
{2:test/functional/fixtures/bigfile.txt 8,1 0%}|
|
|
|
|
|
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('showtabline', 2, {})
|
2022-10-06 17:52:51 -07:00
|
|
|
screen:expect([[
|
|
|
|
{3: }{5:2}{3: t/f/f/bigfile.txt }{4: }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*5
|
2022-10-06 17:52:51 -07:00
|
|
|
────────────────────────────────────────────────────────────|
|
|
|
|
0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
|
|
|
|
0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
|
|
|
|
0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; |
|
|
|
|
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
|
|
|
|
0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
|
|
|
|
^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
|
|
|
|
{2:test/functional/fixtures/bigfile.txt 8,1 0%}|
|
|
|
|
|
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('cmdheight', 0, {})
|
2022-10-06 17:52:51 -07:00
|
|
|
screen:expect([[
|
|
|
|
{3: }{5:2}{3: t/f/f/bigfile.txt }{4: }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*5
|
2022-10-06 17:52:51 -07:00
|
|
|
────────────────────────────────────────────────────────────|
|
|
|
|
0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;; |
|
|
|
|
0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
|
|
|
|
0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
|
|
|
|
0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; |
|
|
|
|
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
|
|
|
|
0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
|
|
|
|
^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
|
|
|
|
{2:test/functional/fixtures/bigfile.txt 8,1 0%}|
|
|
|
|
]])
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('cmdheight', 1, {})
|
2022-10-06 17:52:51 -07:00
|
|
|
screen:expect([[
|
|
|
|
{3: }{5:2}{3: t/f/f/bigfile.txt }{4: }|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*5
|
2022-10-06 17:52:51 -07:00
|
|
|
────────────────────────────────────────────────────────────|
|
|
|
|
0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
|
|
|
|
0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
|
|
|
|
0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; |
|
|
|
|
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
|
|
|
|
0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
|
|
|
|
^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
|
|
|
|
{2:test/functional/fixtures/bigfile.txt 8,1 0%}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2024-02-24 18:03:26 -07:00
|
|
|
|
|
|
|
it('horizontal separators unchanged when failing to split-move window', function()
|
|
|
|
exec([[
|
|
|
|
botright split
|
|
|
|
let &winwidth = &columns
|
|
|
|
let &winminwidth = &columns
|
|
|
|
]])
|
|
|
|
eq('Vim(wincmd):E36: Not enough room', pcall_err(command, 'wincmd L'))
|
|
|
|
command('mode')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
{1:~ }|*5
|
|
|
|
────────────────────────────────────────────────────────────|
|
|
|
|
^ |
|
|
|
|
{1:~ }|*6
|
|
|
|
{2:[No Name] 0,0-1 All}|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2022-05-23 06:11:24 -07:00
|
|
|
end)
|
2022-07-21 15:41:51 -07:00
|
|
|
|
|
|
|
it('statusline does not crash if it has Arabic characters #19447', function()
|
|
|
|
clear()
|
2024-01-12 10:59:57 -07:00
|
|
|
api.nvim_set_option_value('statusline', 'غً', {})
|
|
|
|
api.nvim_set_option_value('laststatus', 2, {})
|
2022-07-21 15:41:51 -07:00
|
|
|
command('redraw!')
|
|
|
|
assert_alive()
|
|
|
|
end)
|
2022-08-03 04:25:03 -07:00
|
|
|
|
|
|
|
it('statusline is redrawn with :resize from <Cmd> mapping #19629', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(40, 8)
|
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
|
|
|
[1] = { bold = true, reverse = true }, -- StatusLine
|
|
|
|
})
|
|
|
|
screen:attach()
|
|
|
|
exec([[
|
|
|
|
set laststatus=2
|
|
|
|
nnoremap <Up> <cmd>resize -1<CR>
|
|
|
|
nnoremap <Down> <cmd>resize +1<CR>
|
|
|
|
]])
|
|
|
|
feed('<Up>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*4
|
2022-08-03 04:25:03 -07:00
|
|
|
{1:[No Name] }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|*2
|
2022-08-03 04:25:03 -07:00
|
|
|
]])
|
|
|
|
feed('<Down>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~ }|*5
|
2022-08-03 04:25:03 -07:00
|
|
|
{1:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
2022-12-26 20:13:58 -07:00
|
|
|
|
|
|
|
it('showcmdloc=statusline does not show if statusline is too narrow', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(40, 8)
|
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
|
|
|
[1] = { bold = true, reverse = true }, -- StatusLine
|
|
|
|
[2] = { reverse = true }, -- StatusLineNC
|
|
|
|
})
|
|
|
|
screen:attach()
|
|
|
|
command('set showcmd')
|
|
|
|
command('set showcmdloc=statusline')
|
|
|
|
command('1vsplit')
|
|
|
|
screen:expect([[
|
|
|
|
^ │ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{0:~}│{0:~ }|*5
|
2022-12-26 20:13:58 -07:00
|
|
|
{1:< }{2:[No Name] }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('1234')
|
|
|
|
screen:expect_unchanged()
|
|
|
|
end)
|
2023-03-06 08:50:27 -07:00
|
|
|
|
|
|
|
it('K_EVENT does not trigger a statusline redraw unnecessarily', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(40, 8)
|
|
|
|
screen:attach()
|
|
|
|
-- does not redraw on vim.schedule (#17937)
|
|
|
|
command([[
|
|
|
|
set laststatus=2
|
|
|
|
let g:counter = 0
|
|
|
|
func Status()
|
|
|
|
let g:counter += 1
|
|
|
|
lua vim.schedule(function() end)
|
|
|
|
return g:counter
|
|
|
|
endfunc
|
|
|
|
set statusline=%!Status()
|
|
|
|
]])
|
|
|
|
sleep(50)
|
|
|
|
eq(1, eval('g:counter < 50'), 'g:counter=' .. eval('g:counter'))
|
|
|
|
-- also in insert mode
|
|
|
|
feed('i')
|
|
|
|
sleep(50)
|
|
|
|
eq(1, eval('g:counter < 50'), 'g:counter=' .. eval('g:counter'))
|
|
|
|
-- does not redraw on timer call (#14303)
|
|
|
|
command([[
|
|
|
|
let g:counter = 0
|
|
|
|
func Timer(timer)
|
|
|
|
endfunc
|
|
|
|
call timer_start(1, 'Timer', {'repeat': 100})
|
|
|
|
]])
|
|
|
|
sleep(50)
|
|
|
|
eq(1, eval('g:counter < 50'), 'g:counter=' .. eval('g:counter'))
|
|
|
|
end)
|
2023-03-31 18:55:43 -07:00
|
|
|
|
2023-06-06 04:24:42 -07:00
|
|
|
it('statusline is redrawn on various state changes', function()
|
2023-03-31 18:55:43 -07:00
|
|
|
clear()
|
|
|
|
local screen = Screen.new(40, 4)
|
|
|
|
screen:attach()
|
2023-06-06 04:24:42 -07:00
|
|
|
|
|
|
|
-- recording state change #22683
|
2023-03-31 18:55:43 -07:00
|
|
|
command('set ls=2 stl=%{repeat(reg_recording(),5)}')
|
2023-06-06 04:24:42 -07:00
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 03:02:52 -07:00
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
|
|
2023-06-06 04:24:42 -07:00
|
|
|
]])
|
2023-03-31 18:55:43 -07:00
|
|
|
feed('qQ')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 03:02:52 -07:00
|
|
|
{1:~ }|
|
|
|
|
{3:QQQQQ }|
|
|
|
|
{5:recording @Q} |
|
2023-03-31 18:55:43 -07:00
|
|
|
]])
|
2023-06-06 04:24:42 -07:00
|
|
|
feed('q')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 03:02:52 -07:00
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
|
|
|
|
|
2023-06-06 04:24:42 -07:00
|
|
|
]])
|
|
|
|
|
|
|
|
-- Visual mode change #23932
|
|
|
|
command('set ls=2 stl=%{mode(1)}')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 03:02:52 -07:00
|
|
|
{1:~ }|
|
|
|
|
{3:n }|
|
2023-06-06 04:24:42 -07:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('v')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 03:02:52 -07:00
|
|
|
{1:~ }|
|
|
|
|
{3:v }|
|
|
|
|
{5:-- VISUAL --} |
|
2023-06-06 04:24:42 -07:00
|
|
|
]])
|
|
|
|
feed('V')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 03:02:52 -07:00
|
|
|
{1:~ }|
|
|
|
|
{3:V }|
|
|
|
|
{5:-- VISUAL LINE --} |
|
2023-06-06 04:24:42 -07:00
|
|
|
]])
|
|
|
|
feed('<C-V>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 03:02:52 -07:00
|
|
|
{1:~ }|
|
|
|
|
{3:^V }|
|
|
|
|
{5:-- VISUAL BLOCK --} |
|
2023-06-06 04:24:42 -07:00
|
|
|
]])
|
|
|
|
feed('<Esc>')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 03:02:52 -07:00
|
|
|
{1:~ }|
|
|
|
|
{3:n }|
|
2023-06-06 04:24:42 -07:00
|
|
|
|
|
|
|
|
]])
|
2023-03-31 18:55:43 -07:00
|
|
|
end)
|
2023-03-31 18:11:56 -07:00
|
|
|
|
|
|
|
it('ruler is redrawn in cmdline with redrawstatus #22804', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(40, 2)
|
|
|
|
screen:attach()
|
|
|
|
command([[
|
|
|
|
let g:n = 'initial value'
|
|
|
|
set ls=1 ru ruf=%{g:n}
|
|
|
|
redraw
|
|
|
|
let g:n = 'other value'
|
|
|
|
redrawstatus
|
|
|
|
]])
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
|
|
|
other value |
|
|
|
|
]])
|
|
|
|
end)
|
2023-04-10 13:40:35 -07:00
|
|
|
|
|
|
|
it('shows correct ruler in cmdline with no statusline', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(30, 8)
|
|
|
|
screen:set_default_attr_ids {
|
|
|
|
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
|
|
|
[2] = { bold = true, reverse = true }, -- StatusLine
|
|
|
|
[3] = { reverse = true }, -- StatusLineNC
|
|
|
|
}
|
|
|
|
screen:attach()
|
|
|
|
-- Use long ruler to check 'ruler' with 'rulerformat' set has correct width.
|
|
|
|
command [[
|
|
|
|
set ruler rulerformat=%{winnr()}longlonglong ls=0 winwidth=10
|
|
|
|
split
|
|
|
|
wincmd b
|
|
|
|
vsplit
|
|
|
|
wincmd t
|
|
|
|
wincmd |
|
|
|
|
mode
|
|
|
|
]]
|
|
|
|
-- Window 1 is current. It has a statusline, so cmdline should show the
|
|
|
|
-- last window's ruler, which has no statusline.
|
|
|
|
command '1wincmd w'
|
|
|
|
screen:expect [[
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2023-04-10 13:40:35 -07:00
|
|
|
{2:[No Name] 1longlonglong }|
|
|
|
|
│ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*2
|
2023-04-10 13:40:35 -07:00
|
|
|
3longlonglong |
|
|
|
|
]]
|
|
|
|
-- Window 2 is current. It has no statusline, so cmdline should show its
|
|
|
|
-- ruler instead.
|
|
|
|
command '2wincmd w'
|
|
|
|
screen:expect [[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2023-04-10 13:40:35 -07:00
|
|
|
{3:[No Name] 1longlonglong }|
|
|
|
|
^ │ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*2
|
2023-04-10 13:40:35 -07:00
|
|
|
2longlonglong |
|
|
|
|
]]
|
|
|
|
-- Window 3 is current. Cmdline should again show its ruler.
|
|
|
|
command '3wincmd w'
|
|
|
|
screen:expect [[
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }|*2
|
2023-04-10 13:40:35 -07:00
|
|
|
{3:[No Name] 1longlonglong }|
|
|
|
|
│^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
{1:~ }│{1:~ }|*2
|
2023-04-10 13:40:35 -07:00
|
|
|
3longlonglong |
|
|
|
|
]]
|
|
|
|
end)
|
2023-09-23 19:49:47 -07:00
|
|
|
|
|
|
|
it('uses "stl" and "stlnc" fillchars even if they are the same #19803', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(53, 4)
|
|
|
|
screen:attach()
|
|
|
|
screen:set_default_attr_ids({
|
|
|
|
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
|
|
|
})
|
|
|
|
command('hi clear StatusLine')
|
|
|
|
command('hi clear StatusLineNC')
|
|
|
|
command('vsplit')
|
|
|
|
screen:expect {
|
|
|
|
grid = [[
|
|
|
|
^ │ |
|
|
|
|
{1:~ }│{1:~ }|
|
|
|
|
[No Name] [No Name] |
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
}
|
|
|
|
end)
|
2024-01-30 17:48:52 -07:00
|
|
|
|
|
|
|
it('showcmdloc=statusline works with vertical splits', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(53, 4)
|
|
|
|
screen:set_default_attr_ids {
|
|
|
|
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
|
|
|
[2] = { bold = true, reverse = true }, -- StatusLine
|
|
|
|
[3] = { reverse = true }, -- StatusLineNC
|
|
|
|
}
|
|
|
|
screen:attach()
|
|
|
|
command('rightbelow vsplit')
|
|
|
|
command('set showcmd showcmdloc=statusline')
|
|
|
|
feed('1234')
|
|
|
|
screen:expect([[
|
|
|
|
│^ |
|
|
|
|
{1:~ }│{1:~ }|
|
|
|
|
{3:[No Name] }{2:[No Name] 1234 }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed('<Esc>')
|
|
|
|
command('set laststatus=3')
|
|
|
|
feed('1234')
|
|
|
|
screen:expect([[
|
|
|
|
│^ |
|
|
|
|
{1:~ }│{1:~ }|
|
|
|
|
{2:[No Name] 1234 }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('keymap is shown with vertical splits #27269', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(53, 4)
|
|
|
|
screen:set_default_attr_ids {
|
|
|
|
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
|
|
|
[2] = { bold = true, reverse = true }, -- StatusLine
|
|
|
|
[3] = { reverse = true }, -- StatusLineNC
|
|
|
|
}
|
|
|
|
screen:attach()
|
|
|
|
command('setlocal keymap=dvorak')
|
|
|
|
command('rightbelow vsplit')
|
|
|
|
screen:expect([[
|
|
|
|
│^ |
|
|
|
|
{1:~ }│{1:~ }|
|
|
|
|
{3:[No Name] <en-dv> }{2:[No Name] <en-dv> }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
command('set laststatus=3')
|
|
|
|
screen:expect([[
|
|
|
|
│^ |
|
|
|
|
{1:~ }│{1:~ }|
|
|
|
|
{2:[No Name] <en-dv> }|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|