2024-04-20 08:44:13 -07:00
|
|
|
|
local t = require('test.testutil')
|
|
|
|
|
local n = require('test.functional.testnvim')()
|
2014-12-08 18:31:45 -07:00
|
|
|
|
local Screen = require('test.functional.ui.screen')
|
2016-04-07 12:40:40 -07:00
|
|
|
|
local os = require('os')
|
2024-04-20 08:44:13 -07:00
|
|
|
|
|
|
|
|
|
local clear, feed, insert = n.clear, n.feed, n.insert
|
|
|
|
|
local command, exec = n.command, n.exec
|
|
|
|
|
local eval = n.eval
|
|
|
|
|
local feed_command, eq = n.feed_command, t.eq
|
|
|
|
|
local fn = n.fn
|
|
|
|
|
local api = n.api
|
|
|
|
|
local exec_lua = n.exec_lua
|
2015-01-15 05:01:25 -07:00
|
|
|
|
|
2017-04-16 18:53:29 -07:00
|
|
|
|
describe('colorscheme compatibility', function()
|
2015-01-15 05:01:25 -07:00
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
end)
|
|
|
|
|
|
2022-12-22 22:56:32 -07:00
|
|
|
|
it('&t_Co exists and is set to 256 by default', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
|
eq(1, fn.exists('&t_Co'))
|
|
|
|
|
eq(1, fn.exists('+t_Co'))
|
2017-04-16 18:53:29 -07:00
|
|
|
|
eq('256', eval('&t_Co'))
|
2015-01-15 05:01:25 -07:00
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
|
2017-04-16 18:53:29 -07:00
|
|
|
|
describe('highlight: `:syntax manual`', function()
|
2016-04-07 12:40:40 -07:00
|
|
|
|
-- When using manual syntax highlighting, it should be preserved even when
|
|
|
|
|
-- switching buffers... bug did only occur without :set hidden
|
|
|
|
|
-- Ref: vim patch 7.4.1236
|
|
|
|
|
local screen
|
|
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
screen = Screen.new(20, 5)
|
2024-02-06 04:30:02 -07:00
|
|
|
|
-- syntax highlight for vimscript's "echo"
|
2016-04-07 12:40:40 -07:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
after_each(function()
|
|
|
|
|
os.remove('Xtest-functional-ui-highlight.tmp.vim')
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it("works with buffer switch and 'hidden'", function()
|
2018-09-23 01:11:56 -07:00
|
|
|
|
command('e tmp1.vim')
|
|
|
|
|
command('e Xtest-functional-ui-highlight.tmp.vim')
|
|
|
|
|
command('filetype on')
|
|
|
|
|
command('syntax manual')
|
|
|
|
|
command('set ft=vim')
|
|
|
|
|
command('set syntax=ON')
|
2016-04-07 12:40:40 -07:00
|
|
|
|
feed('iecho 1<esc>0')
|
|
|
|
|
|
2018-09-23 01:11:56 -07:00
|
|
|
|
command('set hidden')
|
|
|
|
|
command('w')
|
|
|
|
|
command('bn')
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('bp')
|
2016-04-07 12:40:40 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{15:^echo} {26:1} |
|
|
|
|
|
{1:~ }|*3
|
2018-09-23 01:11:56 -07:00
|
|
|
|
:bp |
|
2016-04-07 12:40:40 -07:00
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it("works with buffer switch and 'nohidden'", function()
|
2017-04-16 18:53:29 -07:00
|
|
|
|
command('e tmp1.vim')
|
|
|
|
|
command('e Xtest-functional-ui-highlight.tmp.vim')
|
|
|
|
|
command('filetype on')
|
|
|
|
|
command('syntax manual')
|
|
|
|
|
command('set filetype=vim fileformat=unix')
|
|
|
|
|
command('set syntax=ON')
|
2016-04-07 12:40:40 -07:00
|
|
|
|
feed('iecho 1<esc>0')
|
|
|
|
|
|
2017-04-16 18:53:29 -07:00
|
|
|
|
command('set nohidden')
|
|
|
|
|
command('w')
|
|
|
|
|
command('silent bn')
|
|
|
|
|
eq('tmp1.vim', eval("fnamemodify(bufname('%'), ':t')"))
|
|
|
|
|
feed_command('silent bp')
|
|
|
|
|
eq('Xtest-functional-ui-highlight.tmp.vim', eval("fnamemodify(bufname('%'), ':t')"))
|
2016-04-07 12:40:40 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{15:^echo} {26:1} |
|
|
|
|
|
{1:~ }|*3
|
2017-04-16 18:53:29 -07:00
|
|
|
|
:silent bp |
|
2016-04-07 12:40:40 -07:00
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
|
2017-04-16 18:53:29 -07:00
|
|
|
|
describe('highlight defaults', function()
|
2015-01-26 11:32:20 -07:00
|
|
|
|
local screen
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
screen = Screen.new()
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { foreground = Screen.colors.Red, background = Screen.colors.WebGreen },
|
|
|
|
|
[101] = { italic = true },
|
2022-08-17 07:19:35 -07:00
|
|
|
|
}
|
2014-12-08 18:31:45 -07:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('window status bar', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('sp', 'vsp', 'vsp')
|
2014-12-08 18:31:45 -07:00
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
|
^ │ │ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }│{1:~ }│{1:~ }|*5
|
|
|
|
|
{3:[No Name] }{2:[No Name] [No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*4
|
2014-12-08 18:31:45 -07:00
|
|
|
|
{2:[No Name] }|
|
2018-10-20 14:43:47 -07:00
|
|
|
|
:vsp |
|
2014-12-08 18:31:45 -07:00
|
|
|
|
]])
|
|
|
|
|
-- navigate to verify that the attributes are properly moved
|
|
|
|
|
feed('<c-w>j')
|
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
|
│ │ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }│{1:~ }│{1:~ }|*5
|
2014-12-08 18:31:45 -07:00
|
|
|
|
{2:[No Name] [No Name] [No Name] }|
|
2015-03-05 02:07:55 -07:00
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*4
|
|
|
|
|
{3:[No Name] }|
|
2018-10-20 14:43:47 -07:00
|
|
|
|
:vsp |
|
2014-12-08 18:31:45 -07:00
|
|
|
|
]])
|
|
|
|
|
-- note that when moving to a window with small width nvim will increase
|
|
|
|
|
-- the width of the new active window at the expense of a inactive window
|
|
|
|
|
-- (upstream vim has the same behavior)
|
|
|
|
|
feed('<c-w>k<c-w>l')
|
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
|
│^ │ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }│{1:~ }│{1:~ }|*5
|
|
|
|
|
{2:[No Name] }{3:[No Name] }{2:[No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*4
|
2014-12-08 18:31:45 -07:00
|
|
|
|
{2:[No Name] }|
|
2018-10-20 14:43:47 -07:00
|
|
|
|
:vsp |
|
2014-12-08 18:31:45 -07:00
|
|
|
|
]])
|
|
|
|
|
feed('<c-w>l')
|
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
|
│ │^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }│{1:~ }│{1:~ }|*5
|
|
|
|
|
{2:[No Name] [No Name] }{3:[No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*4
|
2014-12-08 18:31:45 -07:00
|
|
|
|
{2:[No Name] }|
|
2018-10-20 14:43:47 -07:00
|
|
|
|
:vsp |
|
2014-12-08 18:31:45 -07:00
|
|
|
|
]])
|
|
|
|
|
feed('<c-w>h<c-w>h')
|
|
|
|
|
screen:expect([[
|
2022-05-15 09:34:44 -07:00
|
|
|
|
^ │ │ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }│{1:~ }│{1:~ }|*5
|
|
|
|
|
{3:[No Name] }{2:[No Name] [No Name] }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*4
|
2014-12-08 18:31:45 -07:00
|
|
|
|
{2:[No Name] }|
|
2018-10-20 14:43:47 -07:00
|
|
|
|
:vsp |
|
2014-12-08 18:31:45 -07:00
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('insert mode text', function()
|
|
|
|
|
feed('i')
|
2017-03-26 03:15:52 -07:00
|
|
|
|
screen:try_resize(53, 4)
|
2014-12-08 18:31:45 -07:00
|
|
|
|
screen:expect([[
|
2015-03-05 02:07:55 -07:00
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
|
|
|
|
{5:-- INSERT --} |
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2014-12-08 18:31:45 -07:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('end of file markers', function()
|
2017-03-26 03:15:52 -07:00
|
|
|
|
screen:try_resize(53, 4)
|
2014-12-08 18:31:45 -07:00
|
|
|
|
screen:expect([[
|
2015-03-05 02:07:55 -07:00
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2014-12-08 18:31:45 -07:00
|
|
|
|
|
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2014-12-08 18:31:45 -07:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('"wait return" text', function()
|
2017-03-26 03:15:52 -07:00
|
|
|
|
screen:try_resize(53, 4)
|
2014-12-08 18:31:45 -07:00
|
|
|
|
feed(':ls<cr>')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{3: }|
|
2014-12-08 18:31:45 -07:00
|
|
|
|
:ls |
|
|
|
|
|
1 %a "[No Name]" line 1 |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{6:Press ENTER or type command to continue}^ |
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2014-12-08 18:31:45 -07:00
|
|
|
|
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
|
|
|
|
|
end)
|
2017-03-26 03:15:52 -07:00
|
|
|
|
|
2016-05-10 13:04:09 -07:00
|
|
|
|
it('can be cleared and linked to other highlight groups', function()
|
2017-03-26 03:15:52 -07:00
|
|
|
|
screen:try_resize(53, 4)
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('highlight clear ModeMsg')
|
2016-05-10 13:04:09 -07:00
|
|
|
|
feed('i')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2016-05-10 13:04:09 -07:00
|
|
|
|
-- INSERT -- |
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2016-05-10 13:04:09 -07:00
|
|
|
|
feed('<esc>')
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('highlight CustomHLGroup guifg=red guibg=green')
|
|
|
|
|
feed_command('highlight link ModeMsg CustomHLGroup')
|
2016-05-10 13:04:09 -07:00
|
|
|
|
feed('i')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
|
|
|
|
{100:-- INSERT --} |
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2016-05-10 13:04:09 -07:00
|
|
|
|
end)
|
2017-03-26 03:15:52 -07:00
|
|
|
|
|
2016-05-20 17:20:18 -07:00
|
|
|
|
it('can be cleared by assigning NONE', function()
|
2017-03-26 03:15:52 -07:00
|
|
|
|
screen:try_resize(53, 4)
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('syn keyword TmpKeyword neovim')
|
|
|
|
|
feed_command('hi link TmpKeyword ErrorMsg')
|
2016-05-20 17:20:18 -07:00
|
|
|
|
insert('neovim')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{9:neovi^m} |
|
|
|
|
|
{1:~ }|*2
|
2016-05-20 17:20:18 -07:00
|
|
|
|
|
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command(
|
|
|
|
|
'hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE'
|
2016-05-20 17:20:18 -07:00
|
|
|
|
.. ' gui=NONE guifg=NONE guibg=NONE guisp=NONE'
|
|
|
|
|
)
|
|
|
|
|
screen:expect([[
|
|
|
|
|
neovi^m |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2017-03-26 03:15:52 -07:00
|
|
|
|
|
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2017-03-26 03:15:52 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2021-12-07 05:48:39 -07:00
|
|
|
|
it('linking updates window highlight immediately #16552', function()
|
|
|
|
|
screen:try_resize(53, 4)
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2021-12-07 05:48:39 -07:00
|
|
|
|
|
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2021-12-07 05:48:39 -07:00
|
|
|
|
feed_command('hi NonTextAlt guifg=Red')
|
|
|
|
|
feed_command('hi! link NonText NonTextAlt')
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:expect([[
|
2021-12-07 05:48:39 -07:00
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{19:~ }|*2
|
2021-12-07 05:48:39 -07:00
|
|
|
|
:hi! link NonText NonTextAlt |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
]])
|
2021-12-07 05:48:39 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2017-04-16 18:53:29 -07:00
|
|
|
|
it('Cursor after `:hi clear|syntax reset` #6508', function()
|
|
|
|
|
command('highlight clear|syntax reset')
|
|
|
|
|
eq('guifg=bg guibg=fg', eval([[matchstr(execute('hi Cursor'), '\v(gui|cterm).*$')]]))
|
|
|
|
|
end)
|
|
|
|
|
|
2017-03-26 03:15:52 -07:00
|
|
|
|
it('Whitespace highlight', function()
|
|
|
|
|
screen:try_resize(53, 4)
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('highlight NonText gui=NONE guifg=#FF0000')
|
|
|
|
|
feed_command('set listchars=space:.,tab:>-,trail:*,eol:¬ list')
|
2017-03-26 03:15:52 -07:00
|
|
|
|
insert(' ne \t o\tv im ')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
ne{19:.>----.}o{19:>-----}v{19:..}im{19:*^*¬} |
|
|
|
|
|
{19:~ }|*2
|
2017-03-26 03:15:52 -07:00
|
|
|
|
|
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('highlight Whitespace gui=NONE guifg=#0000FF')
|
2017-03-26 03:15:52 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
ne{18:.>----.}o{18:>-----}v{18:..}im{18:*^*}{19:¬} |
|
|
|
|
|
{19:~ }|*2
|
2017-03-26 03:15:52 -07:00
|
|
|
|
:highlight Whitespace gui=NONE guifg=#0000FF |
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]])
|
2016-05-20 17:20:18 -07:00
|
|
|
|
end)
|
2019-07-14 04:26:40 -07:00
|
|
|
|
|
|
|
|
|
it('are sent to UIs', function()
|
|
|
|
|
screen:try_resize(53, 4)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
|
2019-07-14 04:26:40 -07:00
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2019-07-14 04:26:40 -07:00
|
|
|
|
|
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]],
|
2024-04-04 02:26:39 -07:00
|
|
|
|
hl_groups = { EndOfBuffer = 1, MsgSeparator = 3 },
|
2022-08-17 07:19:35 -07:00
|
|
|
|
}
|
2019-07-14 04:26:40 -07:00
|
|
|
|
|
|
|
|
|
command('highlight EndOfBuffer gui=italic')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:~ }|*2
|
2019-07-14 04:26:40 -07:00
|
|
|
|
|
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]],
|
2024-04-04 02:26:39 -07:00
|
|
|
|
hl_groups = { EndOfBuffer = 101, MsgSeparator = 3 },
|
2022-08-17 07:19:35 -07:00
|
|
|
|
}
|
2019-07-14 04:26:40 -07:00
|
|
|
|
|
|
|
|
|
command('highlight clear EndOfBuffer')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2019-07-14 04:26:40 -07:00
|
|
|
|
|
|
2022-08-17 07:19:35 -07:00
|
|
|
|
]],
|
2024-04-04 02:26:39 -07:00
|
|
|
|
hl_groups = { EndOfBuffer = 1, MsgSeparator = 3 },
|
2022-08-17 07:19:35 -07:00
|
|
|
|
}
|
2019-07-14 04:26:40 -07:00
|
|
|
|
end)
|
2014-12-08 18:31:45 -07:00
|
|
|
|
end)
|
2016-04-24 02:46:48 -07:00
|
|
|
|
|
2018-02-28 09:41:37 -07:00
|
|
|
|
describe('highlight', function()
|
2019-10-13 11:18:22 -07:00
|
|
|
|
before_each(clear)
|
2016-04-24 02:46:48 -07:00
|
|
|
|
|
2024-02-05 00:34:17 -07:00
|
|
|
|
it('Visual', function()
|
|
|
|
|
local screen = Screen.new(45, 5)
|
2019-01-02 16:09:35 -07:00
|
|
|
|
insert([[
|
|
|
|
|
line1 foo bar
|
2024-02-05 00:34:17 -07:00
|
|
|
|
abcdefghijklmnopqrs
|
|
|
|
|
ABCDEFGHIJKLMNOPQRS
|
2019-01-02 16:09:35 -07:00
|
|
|
|
]])
|
2024-02-05 00:34:17 -07:00
|
|
|
|
feed('gg')
|
|
|
|
|
command('vsplit')
|
2019-01-02 16:09:35 -07:00
|
|
|
|
|
|
|
|
|
-- Non-blinking block cursor: does NOT highlight char-at-cursor.
|
|
|
|
|
command('set guicursor=a:block-blinkon0')
|
2024-02-05 00:34:17 -07:00
|
|
|
|
feed('V')
|
2019-01-02 16:09:35 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{17: }^l{17:ine1 foo bar} │{17: line1 foo bar} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
|
|
|
|
|
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL LINE --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('<Esc>$vhhh')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line1 foo^ {17:bar} │ line1 foo{17: bar} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
|
|
|
|
|
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL --} |
|
2019-01-02 16:09:35 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
-- Vertical cursor: highlights char-at-cursor. #8983
|
|
|
|
|
command('set guicursor=a:block-blinkon175')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line1 foo{17:^ bar} │ line1 foo{17: bar} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
|
|
|
|
|
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('set selection=exclusive')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line1 foo{17:^ ba}r │ line1 foo{17: ba}r |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
|
|
|
|
|
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('o')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line1 foo{17: ba}^r │ line1 foo{17: ba}r |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
|
|
|
|
|
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('V')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{17: line1 foo ba^r} │{17: line1 foo bar} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
|
|
|
|
|
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL LINE --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('set cursorcolumn')
|
|
|
|
|
feed('<C-V>')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line1 foo{17: ba}^r │ line1 foo{17: ba}r |
|
|
|
|
|
abcdefghijklmn{21:o}pqrs │abcdefghijklmnopqrs |
|
|
|
|
|
ABCDEFGHIJKLMN{21:O}PQRS │ABCDEFGHIJKLMNOPQRS |
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL BLOCK --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('set selection&')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line1 foo{17: ba^r} │ line1 foo{17: bar} |
|
|
|
|
|
abcdefghijklmn{21:o}pqrs │abcdefghijklmnopqrs |
|
|
|
|
|
ABCDEFGHIJKLMN{21:O}PQRS │ABCDEFGHIJKLMNOPQRS |
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL BLOCK --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('^')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{17:^line1 foo }bar │ {17:line1 foo }bar |
|
|
|
|
|
ab{21:c}defghijklmnopqrs │abcdefghijklmnopqrs |
|
|
|
|
|
AB{21:C}DEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL BLOCK --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('2j')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{17:line1 foo }bar │ {17:line1 foo }bar |
|
|
|
|
|
ab{17:cdefghijkl}mnopqrs │ab{17:cdefghijkl}mnopqrs |
|
|
|
|
|
AB{17:^CDEFGHIJKL}MNOPQRS │AB{17:CDEFGHIJKL}MNOPQRS |
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL BLOCK --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('set nocursorcolumn')
|
|
|
|
|
feed('O')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{17:line1 foo }bar │ {17:line1 foo }bar |
|
|
|
|
|
ab{17:cdefghijkl}mnopqrs │ab{17:cdefghijkl}mnopqrs |
|
|
|
|
|
AB{17:CDEFGHIJK^L}MNOPQRS │AB{17:CDEFGHIJKL}MNOPQRS |
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL BLOCK --} |
|
2024-02-05 00:34:17 -07:00
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('set selection=exclusive')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{17:line1 foo} bar │ {17:line1 foo} bar |
|
|
|
|
|
ab{17:cdefghijk}lmnopqrs │ab{17:cdefghijk}lmnopqrs |
|
|
|
|
|
AB{17:CDEFGHIJK}^LMNOPQRS │AB{17:CDEFGHIJK}LMNOPQRS |
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
|
|
|
|
{5:-- VISUAL BLOCK --} |
|
2019-01-02 16:09:35 -07:00
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2018-02-28 09:41:37 -07:00
|
|
|
|
it('cterm=standout gui=standout', function()
|
2019-10-13 11:18:22 -07:00
|
|
|
|
local screen = Screen.new(20, 5)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = {
|
|
|
|
|
foreground = Screen.colors.Blue1,
|
2018-02-28 09:41:37 -07:00
|
|
|
|
bold = true,
|
2024-04-04 02:26:39 -07:00
|
|
|
|
background = Screen.colors.Grey90,
|
2018-02-28 09:41:37 -07:00
|
|
|
|
underline = true,
|
2024-04-04 02:26:39 -07:00
|
|
|
|
standout = true,
|
2024-01-02 18:09:18 -07:00
|
|
|
|
},
|
2024-04-04 02:26:39 -07:00
|
|
|
|
[101] = { underline = true, standout = true, background = Screen.colors.Grey90 },
|
|
|
|
|
}
|
2018-02-28 09:41:37 -07:00
|
|
|
|
feed_command('hi CursorLine cterm=standout,underline gui=standout,underline')
|
|
|
|
|
feed_command('set cursorline')
|
|
|
|
|
feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
|
|
|
|
|
feed('i\t abcd <cr>\t abcd <cr><esc>k')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:>-------.}abcd{1:*¬} |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:^>-------.}{101:abcd}{100:*¬}{101: }|
|
2018-02-28 09:41:37 -07:00
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2019-09-13 14:46:19 -07:00
|
|
|
|
it('strikethrough', function()
|
2019-10-13 11:18:22 -07:00
|
|
|
|
local screen = Screen.new(25, 6)
|
2019-09-13 14:46:19 -07:00
|
|
|
|
feed_command('syntax on')
|
|
|
|
|
feed_command('syn keyword TmpKeyword foo')
|
|
|
|
|
feed_command('hi! Awesome cterm=strikethrough gui=strikethrough')
|
|
|
|
|
feed_command('hi link TmpKeyword Awesome')
|
|
|
|
|
insert([[
|
|
|
|
|
foo
|
|
|
|
|
foo bar
|
|
|
|
|
foobarfoobar
|
|
|
|
|
]])
|
|
|
|
|
screen:expect(
|
|
|
|
|
[[
|
|
|
|
|
{1:foo} |
|
|
|
|
|
{1:foo} bar |
|
|
|
|
|
foobarfoobar |
|
|
|
|
|
^ |
|
|
|
|
|
{2:~ }|
|
|
|
|
|
|
|
2023-05-28 01:28:10 -07:00
|
|
|
|
]],
|
|
|
|
|
{
|
2019-09-13 14:46:19 -07:00
|
|
|
|
[1] = { strikethrough = true },
|
|
|
|
|
[2] = { bold = true, foreground = Screen.colors.Blue1 },
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
end)
|
|
|
|
|
|
2019-06-17 13:35:07 -07:00
|
|
|
|
it('nocombine', function()
|
2019-10-13 11:18:22 -07:00
|
|
|
|
local screen = Screen.new(25, 6)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { underline = true, reverse = true, foreground = Screen.colors.SlateBlue },
|
|
|
|
|
[101] = {
|
2019-06-17 13:35:07 -07:00
|
|
|
|
foreground = Screen.colors.SlateBlue,
|
2024-04-04 02:26:39 -07:00
|
|
|
|
reverse = true,
|
|
|
|
|
background = Screen.colors.Yellow,
|
2019-06-17 13:35:07 -07:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
feed_command('syntax on')
|
|
|
|
|
feed_command('hi! Underlined cterm=underline gui=underline')
|
|
|
|
|
feed_command('syn keyword Underlined foobar')
|
|
|
|
|
feed_command('hi Search cterm=inverse,nocombine gui=inverse,nocombine')
|
|
|
|
|
insert([[
|
|
|
|
|
foobar
|
|
|
|
|
foobar
|
|
|
|
|
]])
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{28:foobar} |*2
|
2019-06-17 13:35:07 -07:00
|
|
|
|
^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2019-06-17 13:35:07 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
feed('/foo')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:foo}{28:bar} |
|
|
|
|
|
{101:foo}{28:bar} |
|
2019-06-17 13:35:07 -07:00
|
|
|
|
|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2019-06-17 13:35:07 -07:00
|
|
|
|
/foo^ |
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
feed('<cr>')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:^foo}{28:bar} |
|
|
|
|
|
{101:foo}{28:bar} |
|
2019-06-17 13:35:07 -07:00
|
|
|
|
|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
|
|
|
|
{19:search hit...uing at TOP} |
|
2019-06-17 13:35:07 -07:00
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
|
|
|
|
|
2018-02-28 09:41:37 -07:00
|
|
|
|
it('guisp (special/undercurl)', function()
|
2019-10-13 11:18:22 -07:00
|
|
|
|
local screen = Screen.new(25, 10)
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('syntax on')
|
|
|
|
|
feed_command('syn keyword TmpKeyword neovim')
|
|
|
|
|
feed_command('syn keyword TmpKeyword1 special')
|
|
|
|
|
feed_command('syn keyword TmpKeyword2 specialwithbg')
|
|
|
|
|
feed_command('syn keyword TmpKeyword3 specialwithfg')
|
|
|
|
|
feed_command('hi! Awesome guifg=red guibg=yellow guisp=red')
|
|
|
|
|
feed_command('hi! Awesome1 guisp=red')
|
|
|
|
|
feed_command('hi! Awesome2 guibg=yellow guisp=red')
|
|
|
|
|
feed_command('hi! Awesome3 guifg=red guisp=red')
|
|
|
|
|
feed_command('hi link TmpKeyword Awesome')
|
|
|
|
|
feed_command('hi link TmpKeyword1 Awesome1')
|
|
|
|
|
feed_command('hi link TmpKeyword2 Awesome2')
|
|
|
|
|
feed_command('hi link TmpKeyword3 Awesome3')
|
2016-04-24 02:46:48 -07:00
|
|
|
|
insert([[
|
|
|
|
|
neovim
|
|
|
|
|
awesome neovim
|
|
|
|
|
wordcontainingneovim
|
|
|
|
|
special
|
|
|
|
|
specialwithbg
|
|
|
|
|
specialwithfg
|
|
|
|
|
]])
|
|
|
|
|
feed('Go<tab>neovim tabbed')
|
|
|
|
|
screen:expect(
|
|
|
|
|
[[
|
|
|
|
|
{1:neovim} |
|
|
|
|
|
awesome {1:neovim} |
|
|
|
|
|
wordcontainingneovim |
|
2016-05-17 13:25:11 -07:00
|
|
|
|
{2:special} |
|
|
|
|
|
{3:specialwithbg} |
|
|
|
|
|
{4:specialwithfg} |
|
2016-04-24 02:46:48 -07:00
|
|
|
|
|
|
|
|
|
|
{1:neovim} tabbed^ |
|
2016-08-09 05:18:13 -07:00
|
|
|
|
{0:~ }|
|
|
|
|
|
{5:-- INSERT --} |
|
2023-05-28 01:28:10 -07:00
|
|
|
|
]],
|
|
|
|
|
{
|
2016-08-09 05:18:13 -07:00
|
|
|
|
[0] = { bold = true, foreground = Screen.colors.Blue },
|
2016-04-24 02:46:48 -07:00
|
|
|
|
[1] = {
|
|
|
|
|
background = Screen.colors.Yellow,
|
|
|
|
|
foreground = Screen.colors.Red,
|
|
|
|
|
special = Screen.colors.Red,
|
|
|
|
|
},
|
2016-05-17 13:25:11 -07:00
|
|
|
|
[2] = { special = Screen.colors.Red },
|
|
|
|
|
[3] = { special = Screen.colors.Red, background = Screen.colors.Yellow },
|
|
|
|
|
[4] = { foreground = Screen.colors.Red, special = Screen.colors.Red },
|
2016-08-09 05:18:13 -07:00
|
|
|
|
[5] = { bold = true },
|
2016-04-24 02:46:48 -07:00
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
end)
|
2023-05-24 05:33:09 -07:00
|
|
|
|
|
2023-05-28 01:28:10 -07:00
|
|
|
|
it("'diff', syntax and extmark #23722", function()
|
2023-05-24 05:33:09 -07:00
|
|
|
|
local screen = Screen.new(25, 10)
|
|
|
|
|
exec([[
|
|
|
|
|
new
|
|
|
|
|
call setline(1, ['', '01234 6789'])
|
|
|
|
|
windo diffthis
|
|
|
|
|
wincmd w
|
|
|
|
|
syn match WarningMsg "^.*$"
|
|
|
|
|
call nvim_buf_add_highlight(0, -1, 'ErrorMsg', 1, 2, 8)
|
|
|
|
|
]])
|
|
|
|
|
screen:expect(
|
|
|
|
|
[[
|
2024-09-22 21:04:07 -07:00
|
|
|
|
{1: }{5:^ }|
|
2023-05-24 05:33:09 -07:00
|
|
|
|
{1: }{2:01}{3:234 67}{2:89}{5: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{4:~ }|*2
|
2023-05-24 05:33:09 -07:00
|
|
|
|
{7:[No Name] [+] }|
|
|
|
|
|
{1: }{6:-----------------------}|
|
2024-09-22 21:04:07 -07:00
|
|
|
|
{1: }{6:-----------------------}|
|
|
|
|
|
{1: } |
|
2023-05-24 05:33:09 -07:00
|
|
|
|
{8:[No Name] }|
|
|
|
|
|
|
|
2023-05-28 01:28:10 -07:00
|
|
|
|
]],
|
|
|
|
|
{
|
2023-05-24 05:33:09 -07:00
|
|
|
|
[0] = { Screen.colors.WebGray, foreground = Screen.colors.DarkBlue },
|
|
|
|
|
[1] = { background = Screen.colors.Grey, foreground = Screen.colors.Blue4 },
|
|
|
|
|
[2] = { foreground = Screen.colors.Red, background = Screen.colors.LightBlue },
|
|
|
|
|
[3] = { foreground = Screen.colors.Grey100, background = Screen.colors.LightBlue },
|
|
|
|
|
[4] = { bold = true, foreground = Screen.colors.Blue },
|
|
|
|
|
[5] = { background = Screen.colors.LightBlue },
|
|
|
|
|
[6] = {
|
|
|
|
|
bold = true,
|
|
|
|
|
background = Screen.colors.LightCyan,
|
|
|
|
|
foreground = Screen.colors.Blue1,
|
|
|
|
|
},
|
|
|
|
|
[7] = { reverse = true, bold = true },
|
|
|
|
|
[8] = { reverse = true },
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
end)
|
2016-04-24 02:46:48 -07:00
|
|
|
|
end)
|
2016-05-14 01:54:05 -07:00
|
|
|
|
|
2017-03-26 04:04:20 -07:00
|
|
|
|
describe("'listchars' highlight", function()
|
2016-05-14 01:54:05 -07:00
|
|
|
|
local screen
|
|
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
screen = Screen.new(20, 5)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it("'cursorline' and 'cursorcolumn'", function()
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('highlight clear ModeMsg')
|
|
|
|
|
feed_command('set cursorline')
|
2016-05-14 01:54:05 -07:00
|
|
|
|
feed('i')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:^ }|
|
|
|
|
|
{1:~ }|*3
|
2016-05-14 01:54:05 -07:00
|
|
|
|
-- INSERT -- |
|
|
|
|
|
]])
|
|
|
|
|
feed('abcdefg<cr>kkasdf')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
abcdefg |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:kkasdf^ }|
|
|
|
|
|
{1:~ }|*2
|
2016-05-14 01:54:05 -07:00
|
|
|
|
-- INSERT -- |
|
|
|
|
|
]])
|
|
|
|
|
feed('<esc>')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
abcdefg |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:kkasd^f }|
|
|
|
|
|
{1:~ }|*2
|
2016-05-14 01:54:05 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set nocursorline')
|
2016-05-14 01:54:05 -07:00
|
|
|
|
screen:expect([[
|
|
|
|
|
abcdefg |
|
|
|
|
|
kkasd^f |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2016-05-14 01:54:05 -07:00
|
|
|
|
:set nocursorline |
|
|
|
|
|
]])
|
|
|
|
|
feed('k')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
abcde^fg |
|
|
|
|
|
kkasdf |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*2
|
2016-05-14 01:54:05 -07:00
|
|
|
|
:set nocursorline |
|
|
|
|
|
]])
|
|
|
|
|
feed('jjji<cr><cr><cr><esc>')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
kkasd |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
|*2
|
2016-05-14 01:54:05 -07:00
|
|
|
|
^f |
|
|
|
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set cursorline')
|
|
|
|
|
feed_command('set cursorcolumn')
|
2016-05-14 01:54:05 -07:00
|
|
|
|
feed('kkiabcdefghijk<esc>hh')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
kkasd {21: } |
|
|
|
|
|
{21:abcdefgh^ijk }|
|
|
|
|
|
{21: } |
|
|
|
|
|
f {21: } |
|
2016-05-14 01:54:05 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('khh')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:kk^asd }|
|
|
|
|
|
ab{21:c}defghijk |
|
|
|
|
|
{21: } |
|
|
|
|
|
f {21: } |
|
2016-05-14 01:54:05 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2020-11-25 08:47:03 -07:00
|
|
|
|
it("'cursorline' and with 'listchars' option", function()
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { foreground = Screen.colors.Red, background = Screen.colors.Grey90 },
|
|
|
|
|
[101] = { foreground = Screen.colors.Blue1, bold = true, background = Screen.colors.Grey90 },
|
|
|
|
|
}
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('highlight clear ModeMsg')
|
|
|
|
|
feed_command('highlight Whitespace guifg=#FF0000')
|
|
|
|
|
feed_command('set cursorline')
|
|
|
|
|
feed_command('set tabstop=8')
|
|
|
|
|
feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
|
2016-05-14 01:54:05 -07:00
|
|
|
|
feed('i\t abcd <cr>\t abcd <cr><esc>k')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{19:>-------.}abcd{19:*}{1:¬} |
|
|
|
|
|
{100:^>-------.}{21:abcd}{100:*}{101:¬}{21: }|
|
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
2016-05-14 01:54:05 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('k')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:^>-------.}{21:abcd}{100:*}{101:¬}{21: }|
|
|
|
|
|
{19:>-------.}abcd{19:*}{1:¬} |
|
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
2016-05-14 01:54:05 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set nocursorline')
|
2016-05-14 01:54:05 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{19:^>-------.}abcd{19:*}{1:¬} |
|
|
|
|
|
{19:>-------.}abcd{19:*}{1:¬} |
|
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
2016-05-14 01:54:05 -07:00
|
|
|
|
:set nocursorline |
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set nowrap')
|
2016-05-17 16:26:03 -07:00
|
|
|
|
feed('ALorem ipsum dolor sit amet<ESC>0')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{19:^>-------.}abcd{19:.}Lorem{1:>}|
|
|
|
|
|
{19:>-------.}abcd{19:*}{1:¬} |
|
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set cursorline')
|
2016-05-17 16:26:03 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:^>-------.}{21:abcd}{100:.}{21:Lorem}{101:>}|
|
|
|
|
|
{19:>-------.}abcd{19:*}{1:¬} |
|
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
:set cursorline |
|
|
|
|
|
]])
|
|
|
|
|
feed('$')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:<}{21:r}{100:.}{21:sit}{100:.}{21:ame^t}{101:¬}{21: }|
|
|
|
|
|
{1:<} |*2
|
|
|
|
|
{1:~ }|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
:set cursorline |
|
|
|
|
|
]])
|
|
|
|
|
feed('G')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{19:>-------.}abcd{19:.}Lorem{1:>}|
|
|
|
|
|
{19:>-------.}abcd{19:*}{1:¬} |
|
|
|
|
|
{101:^¬}{21: }|
|
|
|
|
|
{1:~ }|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
:set cursorline |
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2019-09-15 12:16:44 -07:00
|
|
|
|
it("'listchar' with wrap", function()
|
|
|
|
|
feed_command('set wrap')
|
|
|
|
|
feed_command('set listchars=eol:¬,precedes:< list')
|
|
|
|
|
feed('90ia<esc>')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:<}aaaaaaaaaaaaaaaaaaa|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
aaaaaaaaaaaaaaaaaaaa|*2
|
2024-04-04 02:26:39 -07:00
|
|
|
|
aaaaaaaaa^a{1:¬} |
|
2019-09-15 12:16:44 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('0')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^aaaaaaaaaaaaaaaaaaaa|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
aaaaaaaaaaaaaaaaaaaa|*3
|
2019-09-15 12:16:44 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
it("'listchar' in visual mode", function()
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = {
|
|
|
|
|
foreground = Screen.colors.Blue1,
|
|
|
|
|
bold = true,
|
|
|
|
|
background = Screen.colors.LightGray,
|
|
|
|
|
},
|
|
|
|
|
[101] = { foreground = Screen.colors.Red, background = Screen.colors.Grey90 },
|
|
|
|
|
[102] = { foreground = Screen.colors.Blue1, bold = true, background = Screen.colors.Grey90 },
|
|
|
|
|
[103] = { foreground = Screen.colors.Red, background = Screen.colors.LightGray },
|
|
|
|
|
}
|
2024-02-14 16:49:39 -07:00
|
|
|
|
command('highlight clear ModeMsg')
|
|
|
|
|
command('highlight Whitespace guifg=#FF0000')
|
|
|
|
|
command('set cursorline')
|
|
|
|
|
command('set tabstop=8')
|
|
|
|
|
command('set nowrap')
|
|
|
|
|
command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
|
2016-05-17 16:26:03 -07:00
|
|
|
|
feed('i\t abcd <cr>\t abcd Lorem ipsum dolor sit amet<cr><esc>kkk0')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:^>-------.}{21:abcd}{101:*}{102:¬}{21: }|
|
|
|
|
|
{19:>-------.}abcd{19:.}Lorem{1:>}|
|
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('lllvj')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{19:>-------.}a{17:bcd}{103:*}{100:¬} |
|
|
|
|
|
{103:>-------.}{17:a}^bcd{19:.}Lorem{1:>}|
|
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
-- VISUAL -- |
|
|
|
|
|
]])
|
|
|
|
|
feed('<esc>V')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{19:>-------.}abcd{19:*}{1:¬} |
|
|
|
|
|
{103:>-------.}{17:a}^b{17:cd}{103:.}{17:Lorem}{1:>}|
|
|
|
|
|
{1:¬} |
|
|
|
|
|
{1:~ }|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
-- VISUAL LINE -- |
|
|
|
|
|
]])
|
|
|
|
|
feed('<esc>$')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:<} |
|
|
|
|
|
{102:<}{21:r}{101:.}{21:sit}{101:.}{21:ame^t}{102:¬}{21: }|
|
|
|
|
|
{1:<} |
|
|
|
|
|
{1:~ }|
|
2016-05-17 16:26:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
2016-05-14 01:54:05 -07:00
|
|
|
|
end)
|
2017-03-26 04:04:20 -07:00
|
|
|
|
|
|
|
|
|
it("'cursorline' with :match", function()
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { foreground = Screen.colors.Lime, background = Screen.colors.Red },
|
|
|
|
|
}
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('highlight clear ModeMsg')
|
|
|
|
|
feed_command('highlight Whitespace guifg=#FF0000')
|
|
|
|
|
feed_command('highlight Error guifg=#00FF00')
|
|
|
|
|
feed_command('set nowrap')
|
2017-03-26 04:04:20 -07:00
|
|
|
|
feed('ia \t bc \t <esc>')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
a bc ^ |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*3
|
2017-03-26 04:04:20 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
|
2017-03-26 04:04:20 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
a{19:.>-----.}bc{19:*>---*^*}{1:¬} |
|
|
|
|
|
{1:~ }|*3
|
2017-03-26 04:04:20 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
2017-04-08 14:12:26 -07:00
|
|
|
|
feed_command('match Error /\\s\\+$/')
|
2017-03-26 04:04:20 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
a{19:.>-----.}bc{100:*>---*^*}{1:¬} |
|
|
|
|
|
{1:~ }|*3
|
2017-03-26 04:04:20 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2016-05-14 01:54:05 -07:00
|
|
|
|
end)
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
2022-03-06 16:05:44 -07:00
|
|
|
|
describe('CursorLine and CursorLineNr highlights', function()
|
2017-03-27 18:42:03 -07:00
|
|
|
|
before_each(clear)
|
2018-10-04 10:35:04 -07:00
|
|
|
|
|
2017-03-27 18:42:03 -07:00
|
|
|
|
it('overridden by Error, ColorColumn if fg not set', function()
|
|
|
|
|
local screen = Screen.new(50, 5)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { background = Screen.colors.LightRed },
|
|
|
|
|
[101] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
|
|
|
|
|
}
|
2017-03-27 18:42:03 -07:00
|
|
|
|
|
2018-10-04 10:35:04 -07:00
|
|
|
|
command('filetype on')
|
|
|
|
|
command('syntax on')
|
|
|
|
|
command('set cursorline ft=json')
|
2017-03-27 18:42:03 -07:00
|
|
|
|
feed('i{<cr>"a" : abc // 10;<cr>}<cr><esc>')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{16:{} |
|
|
|
|
|
"{15:a}" : {9:abc} {9:// 10;} |
|
|
|
|
|
{16:}} |
|
|
|
|
|
{21:^ }|
|
2017-03-27 18:42:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
2018-10-04 10:35:04 -07:00
|
|
|
|
command('set colorcolumn=3')
|
2017-03-27 18:42:03 -07:00
|
|
|
|
feed('i <esc>')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{16:{} {100: } |
|
|
|
|
|
"{15:a}{100:"} : {9:abc} {9:// 10;} |
|
|
|
|
|
{16:}} {100: } |
|
|
|
|
|
{21: ^ }{100: }{21: }|
|
2017-03-27 18:42:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2018-10-04 10:35:04 -07:00
|
|
|
|
|
2020-11-25 08:47:03 -07:00
|
|
|
|
it("overridden by NonText in 'showbreak' characters", function()
|
|
|
|
|
local screen = Screen.new(20, 5)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { foreground = Screen.colors.Yellow1 },
|
|
|
|
|
[101] = { foreground = Screen.colors.Yellow1, background = Screen.colors.Blue },
|
|
|
|
|
[102] = { foreground = Screen.colors.Grey0, background = Screen.colors.Grey100 },
|
|
|
|
|
[103] = { foreground = Screen.colors.Yellow1, background = Screen.colors.Grey100 },
|
|
|
|
|
}
|
2020-11-25 08:47:03 -07:00
|
|
|
|
|
|
|
|
|
feed_command('set wrap cursorline')
|
|
|
|
|
feed_command('set showbreak=>>>')
|
|
|
|
|
feed_command('highlight clear NonText')
|
|
|
|
|
feed_command('highlight clear CursorLine')
|
|
|
|
|
feed_command('highlight NonText guifg=Yellow guibg=Blue gui=NONE')
|
|
|
|
|
feed_command('highlight CursorLine guifg=Black guibg=White gui=NONE')
|
|
|
|
|
|
|
|
|
|
feed('30iø<esc>o<esc>30ia<esc>')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
øøøøøøøøøøøøøøøøøøøø|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:>>>}øøøøøøøøøø |
|
|
|
|
|
{102:aaaaaaaaaaaaaaaaaaaa}|
|
|
|
|
|
{101:>>>}{102:aaaaaaaaa^a }|
|
2020-11-25 08:47:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('k')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{102:øøøøøøøøøøøøøøøøøøøø}|
|
|
|
|
|
{101:>>>}{102:øøøøøøøøø^ø }|
|
2020-11-25 08:47:03 -07:00
|
|
|
|
aaaaaaaaaaaaaaaaaaaa|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:>>>}aaaaaaaaaa |
|
2020-11-25 08:47:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed_command('highlight NonText guibg=NONE')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{102:øøøøøøøøøøøøøøøøøøøø}|
|
|
|
|
|
{103:>>>}{102:øøøøøøøøø^ø }|
|
2020-11-25 08:47:03 -07:00
|
|
|
|
aaaaaaaaaaaaaaaaaaaa|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:>>>}aaaaaaaaaa |
|
2020-11-25 08:47:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed_command('set nocursorline')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
øøøøøøøøøøøøøøøøøøøø|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:>>>}øøøøøøøøø^ø |
|
2020-11-25 08:47:03 -07:00
|
|
|
|
aaaaaaaaaaaaaaaaaaaa|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:>>>}aaaaaaaaaa |
|
2020-11-25 08:47:03 -07:00
|
|
|
|
:set nocursorline |
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2021-08-16 00:27:04 -07:00
|
|
|
|
it("'cursorlineopt' screenline", function()
|
|
|
|
|
local screen = Screen.new(20, 5)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { foreground = Screen.colors.Yellow },
|
|
|
|
|
[101] = { foreground = Screen.colors.Red, background = Screen.colors.WebGreen },
|
|
|
|
|
[102] = { foreground = Screen.colors.Black, background = Screen.colors.Grey100 },
|
|
|
|
|
[103] = { foreground = Screen.colors.WebGreen, background = Screen.colors.Red },
|
|
|
|
|
}
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
2022-03-27 14:10:15 -07:00
|
|
|
|
command('set wrap cursorline cursorlineopt=screenline')
|
|
|
|
|
command('set showbreak=>>>')
|
|
|
|
|
command('highlight clear NonText')
|
|
|
|
|
command('highlight clear CursorLine')
|
|
|
|
|
command('highlight NonText guifg=Yellow gui=NONE')
|
|
|
|
|
command('highlight LineNr guifg=Red guibg=Green gui=NONE')
|
|
|
|
|
command('highlight CursorLine guifg=Black guibg=White gui=NONE')
|
|
|
|
|
command('highlight CursorLineNr guifg=Green guibg=Red gui=NONE')
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
feed('30iø<esc>o<esc>30ia<esc>')
|
|
|
|
|
|
|
|
|
|
-- CursorLine should not apply to 'showbreak' when 'cursorlineopt' contains "screenline"
|
|
|
|
|
screen:expect([[
|
|
|
|
|
øøøøøøøøøøøøøøøøøøøø|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:>>>}øøøøøøøøøø |
|
2021-08-16 00:27:04 -07:00
|
|
|
|
aaaaaaaaaaaaaaaaaaaa|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:>>>}{102:aaaaaaaaa^a }|
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('gk')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
øøøøøøøøøøøøøøøøøøøø|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:>>>}øøøøøøøøøø |
|
|
|
|
|
{102:aaaaaaaaaaaa^aaaaaaaa}|
|
|
|
|
|
{100:>>>}aaaaaaaaaa |
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('k')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{102:øøøøøøøøøøøø^øøøøøøøø}|
|
|
|
|
|
{100:>>>}øøøøøøøøøø |
|
2021-08-16 00:27:04 -07:00
|
|
|
|
aaaaaaaaaaaaaaaaaaaa|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{100:>>>}aaaaaaaaaa |
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
-- CursorLineNr should not apply to line number when 'cursorlineopt' does not contain "number"
|
2022-03-27 14:10:15 -07:00
|
|
|
|
command('set relativenumber numberwidth=2')
|
2021-08-16 00:27:04 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:0 }{102:øøøøøøøøøøøø^øøøøøø}|
|
|
|
|
|
{101: }{100:>>>}øøøøøøøøøøøø |
|
|
|
|
|
{101:1 }aaaaaaaaaaaaaaaaaa|
|
|
|
|
|
{101: }{100:>>>}aaaaaaaaaaaa |
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
-- CursorLineNr should apply to line number when 'cursorlineopt' contains "number"
|
2022-03-27 14:10:15 -07:00
|
|
|
|
command('set cursorlineopt+=number')
|
2021-08-16 00:27:04 -07:00
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{103:0 }{102:øøøøøøøøøøøø^øøøøøø}|
|
|
|
|
|
{101: }{100:>>>}øøøøøøøøøøøø |
|
|
|
|
|
{101:1 }aaaaaaaaaaaaaaaaaa|
|
|
|
|
|
{101: }{100:>>>}aaaaaaaaaaaa |
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('gj')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{103:0 }øøøøøøøøøøøøøøøøøø|
|
|
|
|
|
{101: }{100:>>>}{102:øøøøøøøøø^øøø }|
|
|
|
|
|
{101:1 }aaaaaaaaaaaaaaaaaa|
|
|
|
|
|
{101: }{100:>>>}aaaaaaaaaaaa |
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('gj')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:1 }øøøøøøøøøøøøøøøøøø|
|
|
|
|
|
{101: }{100:>>>}øøøøøøøøøøøø |
|
|
|
|
|
{103:0 }{102:aaaaaaaaaaaa^aaaaaa}|
|
|
|
|
|
{101: }{100:>>>}aaaaaaaaaaaa |
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('gj')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:1 }øøøøøøøøøøøøøøøøøø|
|
|
|
|
|
{101: }{100:>>>}øøøøøøøøøøøø |
|
|
|
|
|
{103:0 }aaaaaaaaaaaaaaaaaa|
|
|
|
|
|
{101: }{100:>>>}{102:aaaaaaaaa^aaa }|
|
2021-08-16 00:27:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
2022-03-27 14:10:15 -07:00
|
|
|
|
|
|
|
|
|
-- updated in Insert mode
|
|
|
|
|
feed('I')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{101:1 }øøøøøøøøøøøøøøøøøø|
|
|
|
|
|
{101: }{100:>>>}øøøøøøøøøøøø |
|
|
|
|
|
{103:0 }{102:^aaaaaaaaaaaaaaaaaa}|
|
|
|
|
|
{101: }{100:>>>}aaaaaaaaaaaa |
|
2022-03-27 14:10:15 -07:00
|
|
|
|
{5:-- INSERT --} |
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('<Esc>gg')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{103:0 }{102:^øøøøøøøøøøøøøøøøøø}|
|
|
|
|
|
{101: }{100:>>>}øøøøøøøøøøøø |
|
|
|
|
|
{101:1 }aaaaaaaaaaaaaaaaaa|
|
|
|
|
|
{101: }{100:>>>}aaaaaaaaaaaa |
|
2022-03-27 14:10:15 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('inoremap <F2> <Cmd>call cursor(1, 1)<CR>')
|
|
|
|
|
feed('A')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{103:0 }øøøøøøøøøøøøøøøøøø|
|
|
|
|
|
{101: }{100:>>>}{102:øøøøøøøøøøøø^ }|
|
|
|
|
|
{101:1 }aaaaaaaaaaaaaaaaaa|
|
|
|
|
|
{101: }{100:>>>}aaaaaaaaaaaa |
|
2022-03-27 14:10:15 -07:00
|
|
|
|
{5:-- INSERT --} |
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('<F2>')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{103:0 }{102:^øøøøøøøøøøøøøøøøøø}|
|
|
|
|
|
{101: }{100:>>>}øøøøøøøøøøøø |
|
|
|
|
|
{101:1 }aaaaaaaaaaaaaaaaaa|
|
|
|
|
|
{101: }{100:>>>}aaaaaaaaaaaa |
|
2022-03-27 14:10:15 -07:00
|
|
|
|
{5:-- INSERT --} |
|
|
|
|
|
]])
|
2021-08-16 00:27:04 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2024-09-14 04:20:56 -07:00
|
|
|
|
-- oldtest: Test_cursorline_screenline_resize()
|
|
|
|
|
it("'cursorlineopt' screenline is updated on window resize", function()
|
|
|
|
|
local screen = Screen.new(75, 8)
|
|
|
|
|
exec([[
|
|
|
|
|
50vnew
|
|
|
|
|
call setline(1, repeat('xyz ', 30))
|
|
|
|
|
setlocal number cursorline cursorlineopt=screenline
|
|
|
|
|
normal! $
|
|
|
|
|
]])
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{8: 1 }xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xy│ |
|
|
|
|
|
{8: }z xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz │{1:~ }|
|
|
|
|
|
{8: }{21:xyz xyz xyz xyz xyz xyz xyz^ }│{1:~ }|
|
|
|
|
|
{1:~ }│{1:~ }|*3
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
command('vertical resize -4')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{8: 1 }xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xy│ |
|
|
|
|
|
{8: }z xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz │{1:~ }|
|
|
|
|
|
{8: }{21:xyz xyz xyz xyz xyz xyz xyz xyz xyz^ }│{1:~ }|
|
|
|
|
|
{1:~ }│{1:~ }|*3
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
command('set cpoptions+=n')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{8: 1 }xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xy│ |
|
|
|
|
|
z xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz │{1:~ }|
|
|
|
|
|
{21:xyz xyz xyz xyz xyz xyz xyz xyz^ }│{1:~ }|
|
|
|
|
|
{1:~ }│{1:~ }|*3
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2022-11-11 18:57:29 -07:00
|
|
|
|
-- oldtest: Test_cursorline_after_yank()
|
2019-03-19 04:24:41 -07:00
|
|
|
|
it('always updated. vim-patch:8.1.0849', function()
|
|
|
|
|
local screen = Screen.new(50, 5)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { background = Screen.colors.LightRed },
|
|
|
|
|
[101] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
|
|
|
|
|
}
|
2019-03-19 04:24:41 -07:00
|
|
|
|
command('set cursorline relativenumber')
|
|
|
|
|
command('call setline(1, ["","1","2","3",""])')
|
|
|
|
|
feed('Gy3k')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{15: 0 }{21:^1 }|
|
2019-03-19 04:24:41 -07:00
|
|
|
|
{8: 1 }2 |
|
|
|
|
|
{8: 2 }3 |
|
|
|
|
|
{8: 3 } |
|
|
|
|
|
4 lines yanked |
|
|
|
|
|
]])
|
|
|
|
|
feed('jj')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{8: 2 }1 |
|
|
|
|
|
{8: 1 }2 |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{15: 0 }{21:^3 }|
|
2019-03-19 04:24:41 -07:00
|
|
|
|
{8: 1 } |
|
|
|
|
|
4 lines yanked |
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2022-11-11 18:57:29 -07:00
|
|
|
|
-- oldtest: Test_cursorline_with_visualmode()
|
2019-03-19 04:24:41 -07:00
|
|
|
|
it('with visual area. vim-patch:8.1.1001', function()
|
|
|
|
|
local screen = Screen.new(50, 5)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
|
|
|
|
|
[101] = { background = Screen.colors.LightRed },
|
|
|
|
|
}
|
2019-03-19 04:24:41 -07:00
|
|
|
|
command('set cursorline')
|
|
|
|
|
command('call setline(1, repeat(["abc"], 50))')
|
|
|
|
|
feed('V<C-f>zbkkjk')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{17:abc} |
|
|
|
|
|
^a{17:bc} |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
abc |*2
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{5:-- VISUAL LINE --} |
|
2019-03-19 04:24:41 -07:00
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2022-11-11 18:57:29 -07:00
|
|
|
|
-- oldtest: Test_cursorline_callback()
|
2022-03-22 20:30:02 -07:00
|
|
|
|
it('is updated if cursor is moved up from timer vim-patch:8.2.4591', function()
|
|
|
|
|
local screen = Screen.new(50, 8)
|
|
|
|
|
exec([[
|
|
|
|
|
call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
|
|
|
|
|
set cursorline
|
|
|
|
|
call cursor(4, 1)
|
|
|
|
|
|
|
|
|
|
func Func(timer)
|
|
|
|
|
call cursor(2, 1)
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
call timer_start(300, 'Func')
|
|
|
|
|
]])
|
|
|
|
|
screen:expect({
|
|
|
|
|
grid = [[
|
|
|
|
|
aaaaa |
|
|
|
|
|
bbbbb |
|
|
|
|
|
ccccc |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:^ddddd }|
|
|
|
|
|
{1:~ }|*3
|
2022-03-22 20:30:02 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
timeout = 100,
|
|
|
|
|
})
|
|
|
|
|
screen:expect({
|
|
|
|
|
grid = [[
|
|
|
|
|
aaaaa |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:^bbbbb }|
|
2022-03-22 20:30:02 -07:00
|
|
|
|
ccccc |
|
|
|
|
|
ddddd |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*3
|
2022-03-22 20:30:02 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
})
|
|
|
|
|
end)
|
|
|
|
|
|
2022-03-06 16:05:44 -07:00
|
|
|
|
it('with split windows in diff mode', function()
|
2018-10-04 10:35:04 -07:00
|
|
|
|
local screen = Screen.new(50, 12)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { background = Screen.colors.Plum1, underline = true },
|
|
|
|
|
[101] = { background = Screen.colors.Red1, bold = true, underline = true },
|
|
|
|
|
}
|
2018-10-04 10:35:04 -07:00
|
|
|
|
|
|
|
|
|
command('hi CursorLine ctermbg=red ctermfg=white guibg=red guifg=white')
|
|
|
|
|
command('set cursorline')
|
|
|
|
|
feed('iline 1 some text<cr>line 2 more text<cr>extra line!<cr>extra line!<cr>last line ...<cr>')
|
|
|
|
|
feed('<esc>gg')
|
|
|
|
|
command('vsplit')
|
|
|
|
|
command('enew')
|
|
|
|
|
feed(
|
|
|
|
|
'iline 1 some text<cr>line 2 moRe text!<cr>extra line!<cr>extra line!<cr>extra line!<cr>last line ...<cr>'
|
|
|
|
|
)
|
|
|
|
|
feed('<esc>gg')
|
|
|
|
|
command('windo diffthis')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{7: }{9:line 1 some text }│{7: }{9:^line 1 some text }|
|
|
|
|
|
{7: }{4:line 2 mo}{27:Re text!}{4: }│{7: }{4:line 2 mo}{27:re text}{4: }|
|
|
|
|
|
{7: }{22:extra line! }│{7: }{23:----------------------}|
|
|
|
|
|
{7: }extra line! │{7: }extra line! |*2
|
|
|
|
|
{7: }last line ... │{7: }last line ... |
|
|
|
|
|
{7: } │{7: } |
|
|
|
|
|
{1:~ }│{1:~ }|*3
|
|
|
|
|
{2:[No Name] [+] }{3:[No Name] [+] }|
|
2018-10-04 10:35:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('jjjjj')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{7: }line 1 some text │{7: }line 1 some text |
|
|
|
|
|
{7: }{4:line 2 mo}{27:Re text!}{4: }│{7: }{4:line 2 mo}{27:re text}{4: }|
|
|
|
|
|
{7: }{22:extra line! }│{7: }{23:----------------------}|
|
|
|
|
|
{7: }extra line! │{7: }extra line! |*2
|
|
|
|
|
{7: }last line ... │{7: }last line ... |
|
|
|
|
|
{7: }{9: }│{7: }{9:^ }|
|
|
|
|
|
{1:~ }│{1:~ }|*3
|
|
|
|
|
{2:[No Name] [+] }{3:[No Name] [+] }|
|
2018-10-04 10:35:04 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
2018-10-31 12:24:24 -07:00
|
|
|
|
|
|
|
|
|
-- CursorLine with fg=NONE is "low-priority".
|
|
|
|
|
-- Rendered as underline in a diff-line. #9028
|
|
|
|
|
command('hi CursorLine ctermbg=red ctermfg=NONE guibg=red guifg=NONE')
|
|
|
|
|
feed('kkkk')
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:expect([[
|
|
|
|
|
{7: }line 1 some text │{7: }line 1 some text |
|
|
|
|
|
{7: }{100:line 2 mo}{101:Re text!}{100: }│{7: }{100:^line 2 mo}{101:re text}{100: }|
|
|
|
|
|
{7: }{22:extra line! }│{7: }{23:----------------------}|
|
|
|
|
|
{7: }extra line! │{7: }extra line! |*2
|
|
|
|
|
{7: }last line ... │{7: }last line ... |
|
|
|
|
|
{7: } │{7: } |
|
|
|
|
|
{1:~ }│{1:~ }|*3
|
|
|
|
|
{2:[No Name] [+] }{3:[No Name] [+] }|
|
2018-10-31 12:24:24 -07:00
|
|
|
|
|
|
2024-04-04 02:26:39 -07:00
|
|
|
|
]])
|
2018-10-04 10:35:04 -07:00
|
|
|
|
end)
|
2022-03-06 16:05:44 -07:00
|
|
|
|
|
2022-11-11 18:57:29 -07:00
|
|
|
|
-- oldtest: Test_diff_with_cursorline_number()
|
2022-03-06 16:05:44 -07:00
|
|
|
|
it('CursorLineNr shows correctly just below filler lines', function()
|
|
|
|
|
local screen = Screen.new(50, 12)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { foreground = Screen.colors.Black, bold = true, background = Screen.colors.Grey100 },
|
|
|
|
|
}
|
2022-03-06 16:05:44 -07:00
|
|
|
|
|
|
|
|
|
command('hi CursorLine guibg=red guifg=white')
|
|
|
|
|
command('hi CursorLineNr guibg=white guifg=black gui=bold')
|
|
|
|
|
command('set cursorline number')
|
|
|
|
|
command('call setline(1, ["baz", "foo", "foo", "bar"])')
|
|
|
|
|
feed('2gg0')
|
|
|
|
|
command('vnew')
|
|
|
|
|
command('call setline(1, ["foo", "foo", "bar"])')
|
|
|
|
|
command('windo diffthis')
|
|
|
|
|
command('1wincmd w')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{7: }{8: }{23:-------------------}│{7: }{8: 1 }{22:baz }|
|
|
|
|
|
{7: }{100: 1 }{9:^foo }│{7: }{100: 2 }{9:foo }|
|
|
|
|
|
{7: }{8: 2 }foo │{7: }{8: 3 }foo |
|
|
|
|
|
{7: }{8: 3 }bar │{7: }{8: 4 }bar |
|
|
|
|
|
{1:~ }│{1:~ }|*6
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
2022-03-06 16:05:44 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
command('set cursorlineopt=number')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{7: }{8: }{23:-------------------}│{7: }{8: 1 }{22:baz }|
|
|
|
|
|
{7: }{100: 1 }^foo │{7: }{100: 2 }{9:foo }|
|
|
|
|
|
{7: }{8: 2 }foo │{7: }{8: 3 }foo |
|
|
|
|
|
{7: }{8: 3 }bar │{7: }{8: 4 }bar |
|
|
|
|
|
{1:~ }│{1:~ }|*6
|
|
|
|
|
{3:[No Name] [+] }{2:[No Name] [+] }|
|
2022-03-06 16:05:44 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2017-03-27 18:42:03 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2022-03-27 13:43:51 -07:00
|
|
|
|
describe('CursorColumn highlight', function()
|
2022-04-01 04:46:17 -07:00
|
|
|
|
local screen
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
screen = Screen.new(50, 8)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { background = Screen.colors.Blue1 },
|
|
|
|
|
}
|
2022-04-01 04:46:17 -07:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('is updated when pressing "i" on a TAB character', function()
|
|
|
|
|
exec([[
|
|
|
|
|
call setline(1, ['123456789', "a\tb"])
|
|
|
|
|
set cursorcolumn
|
|
|
|
|
call cursor(2, 2)
|
|
|
|
|
]])
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
1234567{21:8}9 |
|
2022-04-01 04:46:17 -07:00
|
|
|
|
a ^ b |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*5
|
2022-04-01 04:46:17 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('i')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
1{21:2}3456789 |
|
2022-04-01 04:46:17 -07:00
|
|
|
|
a^ b |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*5
|
|
|
|
|
{5:-- INSERT --} |
|
2022-04-01 04:46:17 -07:00
|
|
|
|
]])
|
2022-04-07 08:26:03 -07:00
|
|
|
|
feed('<C-O>')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
1234567{21:8}9 |
|
2022-04-07 08:26:03 -07:00
|
|
|
|
a ^ b |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*5
|
|
|
|
|
{5:-- (insert) --} |
|
2022-04-07 08:26:03 -07:00
|
|
|
|
]])
|
|
|
|
|
feed('i')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
1{21:2}3456789 |
|
2022-04-07 08:26:03 -07:00
|
|
|
|
a^ b |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*5
|
|
|
|
|
{5:-- INSERT --} |
|
2022-04-07 08:26:03 -07:00
|
|
|
|
]])
|
2022-04-01 04:46:17 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2022-11-11 18:57:29 -07:00
|
|
|
|
-- oldtest: Test_cursorcolumn_callback()
|
2022-04-01 04:46:17 -07:00
|
|
|
|
it('is updated if cursor is moved from timer', function()
|
2022-03-27 13:43:51 -07:00
|
|
|
|
exec([[
|
|
|
|
|
call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
|
|
|
|
|
set cursorcolumn
|
|
|
|
|
call cursor(4, 5)
|
|
|
|
|
|
|
|
|
|
func Func(timer)
|
|
|
|
|
call cursor(1, 1)
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
call timer_start(300, 'Func')
|
|
|
|
|
]])
|
|
|
|
|
screen:expect({
|
|
|
|
|
grid = [[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
aaaa{21:a} |
|
|
|
|
|
bbbb{21:b} |
|
|
|
|
|
cccc{21:c} |
|
2022-03-27 13:43:51 -07:00
|
|
|
|
dddd^d |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{1:~ }|*3
|
2022-03-27 13:43:51 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
timeout = 100,
|
|
|
|
|
})
|
|
|
|
|
screen:expect({
|
|
|
|
|
grid = [[
|
|
|
|
|
^aaaaa |
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:b}bbbb |
|
|
|
|
|
{21:c}cccc |
|
|
|
|
|
{21:d}dddd |
|
|
|
|
|
{1:~ }|*3
|
2022-03-27 13:43:51 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
})
|
|
|
|
|
end)
|
2024-03-14 14:54:22 -07:00
|
|
|
|
|
|
|
|
|
it('is not shown on current line with virtualedit', function()
|
|
|
|
|
exec([[
|
|
|
|
|
hi! CursorColumn guibg=Red
|
|
|
|
|
hi! CursorLine guibg=Blue
|
|
|
|
|
set virtualedit=all cursorline cursorcolumn
|
|
|
|
|
]])
|
|
|
|
|
insert('line 1\nline 2\nline 3')
|
|
|
|
|
feed('k')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line {30:1} |
|
|
|
|
|
{100:line ^2 }|
|
|
|
|
|
line {30:3} |
|
|
|
|
|
{1:~ }|*4
|
2024-03-14 14:54:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('l')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line 1{30: } |
|
|
|
|
|
{100:line 2^ }|
|
|
|
|
|
line 3{30: } |
|
|
|
|
|
{1:~ }|*4
|
2024-03-14 14:54:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('l')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line 1 {30: } |
|
|
|
|
|
{100:line 2 ^ }|
|
|
|
|
|
line 3 {30: } |
|
|
|
|
|
{1:~ }|*4
|
2024-03-14 14:54:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
feed('l')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
line 1 {30: } |
|
|
|
|
|
{100:line 2 ^ }|
|
|
|
|
|
line 3 {30: } |
|
|
|
|
|
{1:~ }|*4
|
2024-03-14 14:54:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2022-03-27 13:43:51 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2022-02-11 15:36:17 -07:00
|
|
|
|
describe('ColorColumn highlight', function()
|
|
|
|
|
local screen
|
|
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
screen = Screen.new(40, 15)
|
2024-04-04 02:26:39 -07:00
|
|
|
|
screen:add_extra_attr_ids {
|
|
|
|
|
[100] = { foreground = Screen.colors.Red, background = Screen.colors.Grey90 },
|
|
|
|
|
[101] = { background = Screen.colors.LightRed },
|
|
|
|
|
[102] = { foreground = Screen.colors.Blue1, bold = true, background = Screen.colors.LightRed },
|
|
|
|
|
}
|
2022-02-11 15:36:17 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2022-11-11 18:57:29 -07:00
|
|
|
|
-- oldtest: Test_colorcolumn()
|
2022-02-11 15:36:17 -07:00
|
|
|
|
it('when entering a buffer vim-patch:8.1.2073', function()
|
|
|
|
|
exec([[
|
|
|
|
|
set nohidden
|
|
|
|
|
split
|
|
|
|
|
edit X
|
|
|
|
|
call setline(1, ["1111111111","22222222222","3333333333"])
|
|
|
|
|
set nomodified
|
|
|
|
|
set colorcolumn=3,9
|
|
|
|
|
set number cursorline cursorlineopt=number
|
|
|
|
|
wincmd w
|
|
|
|
|
buf X
|
|
|
|
|
]])
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{15: 1 }11{101:1}11111{101:1}1 |
|
|
|
|
|
{8: 2 }22{101:2}22222{101:2}22 |
|
|
|
|
|
{8: 3 }33{101:3}33333{101:3}3 |
|
|
|
|
|
{1:~ }|*3
|
|
|
|
|
{2:X }|
|
|
|
|
|
{15: 1 }^11{101:1}11111{101:1}1 |
|
|
|
|
|
{8: 2 }22{101:2}22222{101:2}22 |
|
|
|
|
|
{8: 3 }33{101:3}33333{101:3}3 |
|
|
|
|
|
{1:~ }|*3
|
|
|
|
|
{3:X }|
|
2022-02-11 15:36:17 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2022-11-11 18:57:29 -07:00
|
|
|
|
-- oldtest: Test_colorcolumn_bri()
|
2022-02-11 15:36:17 -07:00
|
|
|
|
it("in 'breakindent' vim-patch:8.2.1689", function()
|
|
|
|
|
exec([[
|
|
|
|
|
call setline(1, 'The quick brown fox jumped over the lazy dogs')
|
|
|
|
|
set co=40 linebreak bri briopt=shift:2 cc=40,41,43
|
|
|
|
|
]])
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
^The quick brown fox jumped over the {101: }|
|
|
|
|
|
{101: } {101:l}azy dogs |
|
|
|
|
|
{1:~ }|*12
|
2022-02-11 15:36:17 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2022-11-11 18:57:29 -07:00
|
|
|
|
-- oldtest: Test_colorcolumn_sbr()
|
2022-02-11 15:36:17 -07:00
|
|
|
|
it("in 'showbreak' vim-patch:8.2.1689", function()
|
|
|
|
|
exec([[
|
|
|
|
|
call setline(1, 'The quick brown fox jumped over the lazy dogs')
|
|
|
|
|
set co=40 showbreak=+++>\\ cc=40,41,43
|
|
|
|
|
]])
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
^The quick brown fox jumped over the laz{101:y}|
|
|
|
|
|
{102:+}{1:+}{102:+}{1:>\} dogs |
|
|
|
|
|
{1:~ }|*12
|
2022-02-11 15:36:17 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2023-04-11 01:51:31 -07:00
|
|
|
|
|
|
|
|
|
it('is combined with low-priority CursorLine highlight #23016', function()
|
|
|
|
|
screen:try_resize(40, 2)
|
|
|
|
|
command('set colorcolumn=30 cursorline')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:^ }{101: }{21: }|
|
2023-04-11 01:51:31 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
command('hi clear ColorColumn')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:^ }|
|
2023-04-11 01:51:31 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
command('hi ColorColumn guifg=Red')
|
|
|
|
|
screen:expect([[
|
2024-04-04 02:26:39 -07:00
|
|
|
|
{21:^ }{100: }{21: }|
|
2023-04-11 01:51:31 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2022-02-11 15:36:17 -07:00
|
|
|
|
end)
|
2017-03-27 18:42:03 -07:00
|
|
|
|
|
2018-03-31 02:12:27 -07:00
|
|
|
|
describe('MsgSeparator highlight and msgsep fillchar', function()
|
2019-09-01 02:25:00 -07:00
|
|
|
|
local screen
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
screen = Screen.new(50, 5)
|
2018-03-31 02:12:27 -07:00
|
|
|
|
screen:set_default_attr_ids({
|
|
|
|
|
[1] = { bold = true, foreground = Screen.colors.Blue },
|
|
|
|
|
[2] = { bold = true, reverse = true },
|
|
|
|
|
[3] = { bold = true, foreground = Screen.colors.SeaGreen4 },
|
|
|
|
|
[4] = { background = Screen.colors.Cyan, bold = true, reverse = true },
|
2019-09-01 02:25:00 -07:00
|
|
|
|
[5] = { bold = true, background = Screen.colors.Magenta },
|
|
|
|
|
[6] = { background = Screen.colors.WebGray },
|
|
|
|
|
[7] = {
|
|
|
|
|
background = Screen.colors.WebGray,
|
|
|
|
|
bold = true,
|
|
|
|
|
foreground = Screen.colors.SeaGreen4,
|
|
|
|
|
},
|
|
|
|
|
[8] = { foreground = Screen.colors.Grey0, background = Screen.colors.Gray60 },
|
|
|
|
|
[9] = { foreground = Screen.colors.Grey40, background = Screen.colors.Gray60 },
|
|
|
|
|
[10] = { foreground = tonumber('0x000019'), background = Screen.colors.Gray60 },
|
|
|
|
|
[11] = { background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x666699') },
|
|
|
|
|
[12] = { background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x297d4e') },
|
|
|
|
|
[13] = { background = tonumber('0xff4cff'), bold = true, foreground = tonumber('0xb200ff') },
|
2018-03-31 02:12:27 -07:00
|
|
|
|
})
|
2019-09-01 02:25:00 -07:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('works', function()
|
2018-03-31 02:12:27 -07:00
|
|
|
|
-- defaults
|
|
|
|
|
feed_command('ls')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
|
|
{2: }|
|
|
|
|
|
:ls |
|
|
|
|
|
1 %a "[No Name]" line 1 |
|
|
|
|
|
{3:Press ENTER or type command to continue}^ |
|
|
|
|
|
]])
|
|
|
|
|
feed('<cr>')
|
|
|
|
|
|
|
|
|
|
feed_command('set fillchars+=msgsep:-')
|
|
|
|
|
feed_command('ls')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
|
|
{2:--------------------------------------------------}|
|
|
|
|
|
:ls |
|
|
|
|
|
1 %a "[No Name]" line 1 |
|
|
|
|
|
{3:Press ENTER or type command to continue}^ |
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
-- linked to StatusLine per default
|
|
|
|
|
feed_command('hi StatusLine guibg=Cyan')
|
|
|
|
|
feed_command('ls')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
|
|
{4:--------------------------------------------------}|
|
|
|
|
|
:ls |
|
|
|
|
|
1 %a "[No Name]" line 1 |
|
|
|
|
|
{3:Press ENTER or type command to continue}^ |
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
-- but can be unlinked
|
|
|
|
|
feed_command('hi clear MsgSeparator')
|
|
|
|
|
feed_command('hi MsgSeparator guibg=Magenta gui=bold')
|
|
|
|
|
feed_command('ls')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
|
|
|
|
|
|
{5:--------------------------------------------------}|
|
|
|
|
|
:ls |
|
|
|
|
|
1 %a "[No Name]" line 1 |
|
|
|
|
|
{3:Press ENTER or type command to continue}^ |
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2019-09-01 02:25:00 -07:00
|
|
|
|
|
|
|
|
|
it('and MsgArea', function()
|
|
|
|
|
feed_command('hi MsgArea guibg=Gray')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*3
|
2019-09-01 02:25:00 -07:00
|
|
|
|
{6: }|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
feed(':ls')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*3
|
2019-09-01 02:25:00 -07:00
|
|
|
|
{6::ls^ }|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
feed(':<cr>')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
|
|
|
|
|
|
{2: }|
|
|
|
|
|
{6::ls: }|
|
|
|
|
|
{6: 1 %a "[No Name]" line 1 }|
|
|
|
|
|
{7:Press ENTER or type command to continue}{6:^ }|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- support madness^Wblending of message "overlay"
|
|
|
|
|
feed_command('hi MsgArea blend=20')
|
|
|
|
|
feed_command('hi clear MsgSeparator')
|
|
|
|
|
feed_command('hi MsgSeparator blend=30 guibg=Magenta')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*3
|
2019-09-01 02:25:00 -07:00
|
|
|
|
{8::hi}{9: }{8:MsgSeparator}{9: }{8:blend=30}{9: }{8:guibg=Magenta}{9: }|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
feed(':ls')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*3
|
2019-09-01 02:25:00 -07:00
|
|
|
|
{8::ls}{9:^ }|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
feed('<cr>')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
|
|
|
|
|
|
{13:~ }|
|
|
|
|
|
{10::ls}{11: }|
|
|
|
|
|
{11:~ }{10:1}{11: }{10:%a}{11: }{10:"[No}{11: }{10:Name]"}{11: }{10:line}{11: }{10:1}{11: }|
|
|
|
|
|
{12:Press}{9: }{12:ENTER}{9: }{12:or}{9: }{12:type}{9: }{12:command}{9: }{12:to}{9: }{12:continue}{9:^ }|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
2018-03-31 02:12:27 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
describe("'winhighlight' highlight", function()
|
|
|
|
|
local screen
|
|
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
screen = Screen.new(20, 8)
|
2022-11-12 08:41:36 -07:00
|
|
|
|
screen:set_default_attr_ids {
|
|
|
|
|
[0] = { bold = true, foreground = Screen.colors.Blue },
|
|
|
|
|
[1] = { background = Screen.colors.DarkBlue },
|
|
|
|
|
[2] = { background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Blue1 },
|
|
|
|
|
[3] = { bold = true, reverse = true },
|
|
|
|
|
[4] = { reverse = true },
|
|
|
|
|
[5] = { background = Screen.colors.DarkGreen },
|
|
|
|
|
[6] = { background = Screen.colors.DarkGreen, bold = true, foreground = Screen.colors.Blue1 },
|
|
|
|
|
[7] = { background = Screen.colors.DarkMagenta },
|
|
|
|
|
[8] = {
|
|
|
|
|
background = Screen.colors.DarkMagenta,
|
|
|
|
|
bold = true,
|
|
|
|
|
foreground = Screen.colors.Blue1,
|
2024-01-02 18:09:18 -07:00
|
|
|
|
},
|
2022-11-12 08:41:36 -07:00
|
|
|
|
[9] = { foreground = Screen.colors.Brown },
|
|
|
|
|
[10] = { foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue },
|
|
|
|
|
[11] = { background = Screen.colors.DarkBlue, bold = true, reverse = true },
|
|
|
|
|
[12] = { background = Screen.colors.DarkGreen, reverse = true },
|
|
|
|
|
[13] = { background = Screen.colors.Magenta4, reverse = true },
|
|
|
|
|
[14] = { background = Screen.colors.DarkBlue, reverse = true },
|
|
|
|
|
[15] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
|
|
|
|
|
[16] = { foreground = Screen.colors.Blue1 },
|
|
|
|
|
[17] = { background = Screen.colors.LightRed },
|
|
|
|
|
[18] = { background = Screen.colors.Gray90 },
|
|
|
|
|
[19] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
|
|
|
|
|
[20] = { background = Screen.colors.LightGrey, underline = true },
|
|
|
|
|
[21] = { bold = true },
|
|
|
|
|
[22] = { bold = true, foreground = Screen.colors.SeaGreen4 },
|
|
|
|
|
[23] = { background = Screen.colors.LightMagenta },
|
|
|
|
|
[24] = { background = Screen.colors.WebGray },
|
|
|
|
|
[25] = { bold = true, foreground = Screen.colors.Green1 },
|
|
|
|
|
[26] = { background = Screen.colors.Red },
|
|
|
|
|
[27] = { background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1 },
|
|
|
|
|
[28] = { bold = true, foreground = Screen.colors.Brown },
|
2022-07-25 01:16:33 -07:00
|
|
|
|
[29] = { foreground = Screen.colors.Blue1, background = Screen.colors.Red, bold = true },
|
2022-11-12 08:41:36 -07:00
|
|
|
|
[30] = { background = tonumber('0xff8800') },
|
|
|
|
|
[31] = { background = tonumber('0xff8800'), bold = true, foreground = Screen.colors.Blue },
|
2024-10-12 10:57:31 -07:00
|
|
|
|
[32] = { bold = true, reverse = true, background = Screen.colors.DarkGreen },
|
2022-11-12 08:41:36 -07:00
|
|
|
|
}
|
2017-04-29 01:34:22 -07:00
|
|
|
|
command('hi Background1 guibg=DarkBlue')
|
|
|
|
|
command('hi Background2 guibg=DarkGreen')
|
|
|
|
|
end)
|
|
|
|
|
|
2017-05-08 09:36:03 -07:00
|
|
|
|
it('works for background color', function()
|
2017-04-29 01:34:22 -07:00
|
|
|
|
insert('aa')
|
|
|
|
|
command('split')
|
|
|
|
|
command('set winhl=Normal:Background1')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:a^a }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] [+] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
aa |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('enew')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
aa |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2023-03-12 00:41:39 -07:00
|
|
|
|
it('works for background color in rightleft window #22640', function()
|
|
|
|
|
-- Use a wide screen to also check that this doesn't overflow linebuf_attr.
|
|
|
|
|
screen:try_resize(80, 6)
|
2023-03-11 21:10:27 -07:00
|
|
|
|
insert('aa')
|
|
|
|
|
command('setlocal rightleft')
|
|
|
|
|
command('setlocal winhl=Normal:Background1')
|
|
|
|
|
screen:expect([[
|
2023-03-12 00:41:39 -07:00
|
|
|
|
{1: ^aa}|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2: ~}|*4
|
2023-03-12 00:41:39 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
command('botright vsplit')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1: aa│ ^aa}|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2: ~}{1:│}{2: ~}|*3
|
2023-03-12 00:41:39 -07:00
|
|
|
|
{4:[No Name] [+] }{3:[No Name] [+] }|
|
|
|
|
|
|
|
2023-03-11 21:10:27 -07:00
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2022-07-25 01:16:33 -07:00
|
|
|
|
it('handles undefined groups', function()
|
2017-04-29 01:34:22 -07:00
|
|
|
|
command('set winhl=Normal:Background1')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*6
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
2022-07-25 01:16:33 -07:00
|
|
|
|
command('set winhl=xxx:yyy')
|
|
|
|
|
eq('xxx:yyy', eval('&winhl'))
|
2017-06-26 05:49:15 -07:00
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
2022-07-25 01:16:33 -07:00
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*6
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
2022-07-25 01:16:33 -07:00
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('can be changed to define different groups', function()
|
|
|
|
|
command('set winhl=EndOfBuffer:Background1')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*6
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
command('set winhl=Normal:ErrorMsg')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
{15:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{29:~ }|*6
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
2017-04-29 01:34:22 -07:00
|
|
|
|
end)
|
|
|
|
|
|
2022-07-14 18:22:50 -07:00
|
|
|
|
it('works local to the window', function()
|
2017-04-29 01:34:22 -07:00
|
|
|
|
insert('aa')
|
|
|
|
|
command('split')
|
|
|
|
|
command('setlocal winhl=Normal:Background1')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:a^a }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] [+] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
aa |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('enew')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
aa |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('bnext')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:^aa }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] [+] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
aa |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] [+] }|
|
2018-09-23 01:11:56 -07:00
|
|
|
|
|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2017-05-08 09:36:03 -07:00
|
|
|
|
it('for inactive window background works', function()
|
2017-04-29 01:34:22 -07:00
|
|
|
|
command('set winhl=Normal:Background1,NormalNC:Background2')
|
|
|
|
|
-- tests global value is copied across split
|
|
|
|
|
command('split')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{5: }|
|
|
|
|
|
{6:~ }|
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('<c-w><c-w>')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{5: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{6:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{1:^ }|
|
|
|
|
|
{2:~ }|
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('<c-w><c-w>')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{5: }|
|
|
|
|
|
{6:~ }|
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('works with NormalNC', function()
|
|
|
|
|
command('hi NormalNC guibg=DarkMagenta')
|
|
|
|
|
-- tests global value is copied across split
|
|
|
|
|
command('split')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
{7: }|
|
|
|
|
|
{8:~ }|
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('wincmd w')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{7: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{8:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
^ |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
-- winbg=Normal:... overrides global NormalNC
|
|
|
|
|
command('set winhl=Normal:Background1')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{7: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{8:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{1:^ }|
|
|
|
|
|
{2:~ }|
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('wincmd w')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
{1: }|
|
|
|
|
|
{2:~ }|
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('wincmd w')
|
|
|
|
|
command('set winhl=Normal:Background1,NormalNC:Background2')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{7: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{8:~ }|*2
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{1:^ }|
|
|
|
|
|
{2:~ }|
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{3:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('wincmd w')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2017-04-29 01:34:22 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
{5: }|
|
|
|
|
|
{6:~ }|
|
2018-04-08 00:51:22 -07:00
|
|
|
|
{4:[No Name] }|
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2022-11-12 08:41:36 -07:00
|
|
|
|
it('updates background to changed linked group', function()
|
|
|
|
|
command('split')
|
|
|
|
|
command('setlocal winhl=Normal:FancyGroup') -- does not yet exist
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2022-11-12 08:41:36 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
command('hi FancyGroup guibg=#FF8800') -- nice orange
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
{30:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{31:~ }|*2
|
2022-11-12 08:41:36 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
|
|
|
|
|
2017-05-08 09:36:03 -07:00
|
|
|
|
it('background applies also to non-text', function()
|
2018-02-07 17:11:54 -07:00
|
|
|
|
command('set sidescroll=0')
|
2017-04-29 01:34:22 -07:00
|
|
|
|
insert('Lorem ipsum dolor sit amet ')
|
|
|
|
|
command('set shiftwidth=2')
|
|
|
|
|
feed('>>')
|
|
|
|
|
command('set number')
|
|
|
|
|
command('set breakindent')
|
|
|
|
|
command('set briopt=shift:5,min:0')
|
|
|
|
|
command('set list')
|
|
|
|
|
command('set showbreak=↪')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{9: 1 } ^Lorem ipsum do|
|
|
|
|
|
{9: } {0:↪}lor sit |
|
|
|
|
|
{9: } {0:↪}amet{0:-} |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*4
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('set winhl=Normal:Background1')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{10: 1 }{1: ^Lorem ipsum do}|
|
|
|
|
|
{10: }{1: }{2:↪}{1:lor sit }|
|
|
|
|
|
{10: }{1: }{2:↪}{1:amet}{2:-}{1: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*4
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('set nowrap')
|
|
|
|
|
command('set listchars+=extends:❯,precedes:❮')
|
|
|
|
|
feed('3w')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{10: 1 }{2:❮}{1: dolor ^sit ame}{2:❯}|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*6
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2018-04-02 05:21:14 -07:00
|
|
|
|
it("background doesn't override syntax background", function()
|
|
|
|
|
command('syntax on')
|
|
|
|
|
command('syntax keyword Foobar foobar')
|
|
|
|
|
command('syntax keyword Article the')
|
|
|
|
|
command('hi Foobar guibg=#FF0000')
|
|
|
|
|
command('hi Article guifg=#00FF00 gui=bold')
|
|
|
|
|
insert('the foobar was foobar')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{25:the} {26:foobar} was {26:fooba}|
|
|
|
|
|
{26:^r} |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*5
|
2018-04-02 05:21:14 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
-- winhl=Normal:Group with background doesn't override syntax background,
|
|
|
|
|
-- but does combine with syntax foreground.
|
|
|
|
|
command('set winhl=Normal:Background1')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{27:the}{1: }{26:foobar}{1: was }{26:fooba}|
|
|
|
|
|
{26:^r}{1: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{2:~ }|*5
|
2018-04-02 05:21:14 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
2017-05-08 09:36:03 -07:00
|
|
|
|
it('can override NonText, Conceal and EndOfBuffer', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
|
api.nvim_buf_set_lines(0, 0, -1, true, { 'raa\000' })
|
2017-05-08 09:36:03 -07:00
|
|
|
|
command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
|
|
|
|
|
command('set cole=2 cocu=nvic')
|
|
|
|
|
command('split')
|
|
|
|
|
command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
|
|
|
|
|
command('set winhl=SpecialKey:ErrorMsg,EndOfBuffer:Background1,' .. 'Conceal:Background2')
|
|
|
|
|
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^r{5:#}a{15:^@} |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*2
|
2017-05-08 09:36:03 -07:00
|
|
|
|
{3:[No Name] [+] }|
|
|
|
|
|
r{19:#}a{16:^@} |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('can override LineNr, CursorColumn and ColorColumn', function()
|
|
|
|
|
insert('very text\nmore text')
|
|
|
|
|
command('set number')
|
|
|
|
|
command('set colorcolumn=2')
|
|
|
|
|
command('set cursorcolumn')
|
2019-03-09 15:12:33 -07:00
|
|
|
|
feed('k')
|
2017-05-08 09:36:03 -07:00
|
|
|
|
|
|
|
|
|
command('split')
|
|
|
|
|
command('set winhl=LineNr:Background1,CursorColumn:Background2,' .. 'ColorColumn:ErrorMsg')
|
|
|
|
|
screen:expect([[
|
2019-03-09 15:12:33 -07:00
|
|
|
|
{1: 1 }v{15:e}ry tex^t |
|
|
|
|
|
{1: 2 }m{15:o}re tex{5:t} |
|
2017-05-08 09:36:03 -07:00
|
|
|
|
{0:~ }|
|
|
|
|
|
{3:[No Name] [+] }|
|
2019-03-09 15:12:33 -07:00
|
|
|
|
{9: 1 }v{17:e}ry text |
|
|
|
|
|
{9: 2 }m{17:o}re tex{18:t} |
|
2017-05-08 09:36:03 -07:00
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('can override Tabline', function()
|
|
|
|
|
command('tabnew')
|
|
|
|
|
command('set winhl=TabLine:Background1,TabLineSel:ErrorMsg')
|
|
|
|
|
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{20: No Name] }{15: No Name]}{20:X}|
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*5
|
2017-05-08 09:36:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
command('tabnext')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{21: No Name] }{1: No Name]}{20:X}|
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*5
|
2017-05-08 09:36:03 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('can override popupmenu', function()
|
|
|
|
|
insert('word wording wordy')
|
|
|
|
|
command('split')
|
|
|
|
|
command(
|
|
|
|
|
'set winhl=Pmenu:Background1,PmenuSel:Background2,' .. 'PmenuSbar:ErrorMsg,PmenuThumb:Normal'
|
|
|
|
|
)
|
|
|
|
|
screen:expect([[
|
|
|
|
|
word wording word^y |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2017-05-08 09:36:03 -07:00
|
|
|
|
{3:[No Name] [+] }|
|
|
|
|
|
word wording wordy |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
2017-04-29 01:34:22 -07:00
|
|
|
|
|
2017-05-08 09:36:03 -07:00
|
|
|
|
feed('oword<c-x><c-p>')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
word wording wordy |
|
|
|
|
|
wordy^ |
|
|
|
|
|
{1:word }{0: }|
|
|
|
|
|
{1:wording }{3: }|
|
|
|
|
|
{5:wordy }rdy |
|
|
|
|
|
wordy |
|
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
{21:-- }{22:match 1 of 3} |
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
feed('<esc>u<c-w><c-w>oword<c-x><c-p>')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
word wording wordy |
|
|
|
|
|
wordy |
|
|
|
|
|
{23:word }{0: }|
|
|
|
|
|
{23:wording }{4: }|
|
|
|
|
|
{24:wordy }rdy |
|
|
|
|
|
wordy^ |
|
|
|
|
|
{3:[No Name] [+] }|
|
|
|
|
|
{21:-- }{22:match 1 of 3} |
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2020-01-28 04:49:29 -07:00
|
|
|
|
|
|
|
|
|
it('can override CursorLine and CursorLineNr', function()
|
|
|
|
|
-- CursorLine used to be parsed as CursorLineNr, because strncmp
|
|
|
|
|
command('set cursorline number')
|
|
|
|
|
command('split')
|
|
|
|
|
command('set winhl=CursorLine:Background1')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
{28: 1 }{1:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2020-01-28 04:49:29 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
{28: 1 }{18: }|
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
command('set winhl=CursorLineNr:Background2,CursorLine:Background1')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
{5: 1 }{1:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2020-01-28 04:49:29 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
{28: 1 }{18: }|
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
feed('<c-w>w')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
{5: 1 }{1: }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2020-01-28 04:49:29 -07:00
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
{28: 1 }{18:^ }|
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
2022-07-14 18:22:50 -07:00
|
|
|
|
|
|
|
|
|
it('can override StatusLine and StatusLineNC', function()
|
|
|
|
|
command('set winhighlight=StatusLine:Background1,StatusLineNC:Background2')
|
|
|
|
|
command('split')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2022-07-14 18:22:50 -07:00
|
|
|
|
{1:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{5:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('can override WinBar and WinBarNC #19345', function()
|
|
|
|
|
command('setlocal winbar=foobar')
|
|
|
|
|
command('set winhighlight=WinBar:Background1,WinBarNC:Background2')
|
|
|
|
|
command('split')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{1:foobar }|
|
|
|
|
|
^ |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
{5:foobar }|
|
|
|
|
|
|
|
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
end)
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
it('can override syntax groups', function()
|
|
|
|
|
command('syntax on')
|
|
|
|
|
command('syntax keyword Foobar foobar')
|
|
|
|
|
command('syntax keyword Article the')
|
|
|
|
|
command('hi Foobar guibg=#FF0000')
|
|
|
|
|
command('hi Article guifg=#00FF00 gui=bold')
|
|
|
|
|
insert('the foobar was foobar')
|
|
|
|
|
screen:expect([[
|
|
|
|
|
{25:the} {26:foobar} was {26:fooba}|
|
|
|
|
|
{26:^r} |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*5
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
command('split')
|
|
|
|
|
command('set winhl=Foobar:Background1,Article:ErrorMsg')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
{15:the} {1:foobar} was {1:fooba}|
|
|
|
|
|
{1:^r} |
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{3:[No Name] [+] }|
|
|
|
|
|
{25:the} {26:foobar} was {26:fooba}|
|
|
|
|
|
{26:r} |
|
|
|
|
|
{4:[No Name] [+] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
2022-08-18 00:43:07 -07:00
|
|
|
|
|
|
|
|
|
it('can be disabled in newly opened window #19823', function()
|
|
|
|
|
command('split | set winhl=Normal:ErrorMsg | set winhl=')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2022-08-18 00:43:07 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 08:44:13 -07:00
|
|
|
|
n.assert_alive()
|
2022-08-18 00:43:07 -07:00
|
|
|
|
end)
|
2022-08-22 08:29:26 -07:00
|
|
|
|
|
|
|
|
|
it('can redraw statusline on cursor movement', function()
|
|
|
|
|
screen:try_resize(40, 8)
|
|
|
|
|
exec [[
|
|
|
|
|
set statusline=%f%=%#Background1#%l,%c%V\ %P
|
|
|
|
|
split
|
|
|
|
|
]]
|
|
|
|
|
insert [[
|
|
|
|
|
some text
|
|
|
|
|
more text]]
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
some text |
|
|
|
|
|
more tex^t |
|
|
|
|
|
{0:~ }|
|
2024-10-12 10:57:31 -07:00
|
|
|
|
{3:[No Name] }{11:2,9 All}|
|
2022-08-22 08:29:26 -07:00
|
|
|
|
some text |
|
|
|
|
|
more text |
|
2024-10-12 10:57:31 -07:00
|
|
|
|
{4:[No Name] }{14:1,1 All}|
|
2022-08-22 08:29:26 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
command 'set winhl=Background1:Background2'
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
some text |
|
|
|
|
|
more tex^t |
|
|
|
|
|
{0:~ }|
|
2024-10-12 10:57:31 -07:00
|
|
|
|
{3:[No Name] }{32:2,9 All}|
|
2022-08-22 08:29:26 -07:00
|
|
|
|
some text |
|
|
|
|
|
more text |
|
2024-10-12 10:57:31 -07:00
|
|
|
|
{4:[No Name] }{14:1,1 All}|
|
2022-08-22 08:29:26 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
feed 'k'
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
some tex^t |
|
|
|
|
|
more text |
|
|
|
|
|
{0:~ }|
|
2024-10-12 10:57:31 -07:00
|
|
|
|
{3:[No Name] }{32:1,9 All}|
|
2022-08-22 08:29:26 -07:00
|
|
|
|
some text |
|
|
|
|
|
more text |
|
2024-10-12 10:57:31 -07:00
|
|
|
|
{4:[No Name] }{14:1,1 All}|
|
2022-08-22 08:29:26 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
2023-04-06 01:03:37 -07:00
|
|
|
|
|
|
|
|
|
it('can link to empty highlight group', function()
|
|
|
|
|
command 'hi NormalNC guibg=Red' -- czerwone time
|
|
|
|
|
command 'set winhl=NormalNC:Normal'
|
|
|
|
|
command 'split'
|
|
|
|
|
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{0:~ }|*2
|
2023-04-06 01:03:37 -07:00
|
|
|
|
{3:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
{0:~ }|
|
|
|
|
|
{4:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
2022-07-25 01:16:33 -07:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
describe('highlight namespaces', function()
|
|
|
|
|
local screen
|
|
|
|
|
local ns1, ns2
|
|
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
screen = Screen.new(25, 10)
|
|
|
|
|
screen:set_default_attr_ids {
|
|
|
|
|
[1] = { foreground = Screen.colors.Blue, bold = true },
|
|
|
|
|
[2] = { background = Screen.colors.DarkGrey },
|
|
|
|
|
[3] = {
|
|
|
|
|
italic = true,
|
|
|
|
|
foreground = Screen.colors.DarkCyan,
|
|
|
|
|
background = Screen.colors.DarkOrange4,
|
2024-01-02 18:09:18 -07:00
|
|
|
|
},
|
2022-07-25 01:16:33 -07:00
|
|
|
|
[4] = { background = Screen.colors.Magenta4 },
|
|
|
|
|
[5] = { background = Screen.colors.Magenta4, foreground = Screen.colors.Crimson },
|
|
|
|
|
[6] = { bold = true, reverse = true },
|
|
|
|
|
[7] = { reverse = true },
|
2022-08-17 08:38:35 -07:00
|
|
|
|
[8] = { foreground = Screen.colors.Gray20 },
|
2023-10-03 04:26:11 -07:00
|
|
|
|
[9] = { foreground = Screen.colors.Blue },
|
|
|
|
|
[10] = { bold = true, foreground = Screen.colors.SeaGreen },
|
2022-07-25 01:16:33 -07:00
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
|
ns1 = api.nvim_create_namespace 'grungy'
|
|
|
|
|
ns2 = api.nvim_create_namespace 'ultrared'
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
|
api.nvim_set_hl(ns1, 'Normal', { bg = 'DarkGrey' })
|
|
|
|
|
api.nvim_set_hl(ns1, 'NonText', { bg = 'DarkOrange4', fg = 'DarkCyan', italic = true })
|
|
|
|
|
api.nvim_set_hl(ns2, 'Normal', { bg = 'DarkMagenta' })
|
|
|
|
|
api.nvim_set_hl(ns2, 'NonText', { fg = 'Crimson' })
|
2022-07-25 01:16:33 -07:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('can be used globally', function()
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*8
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
|
api.nvim_set_hl_ns(ns1)
|
2022-07-25 01:16:33 -07:00
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
{2:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{3:~ }|*8
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
|
api.nvim_set_hl_ns(ns2)
|
2022-07-25 01:16:33 -07:00
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
{4:^ }|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{5:~ }|*8
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
|
api.nvim_set_hl_ns(0)
|
2022-07-25 01:16:33 -07:00
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*8
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('can be used per window', function()
|
2024-01-12 10:59:57 -07:00
|
|
|
|
local win1 = api.nvim_get_current_win()
|
2022-07-25 01:16:33 -07:00
|
|
|
|
command 'split'
|
2024-01-12 10:59:57 -07:00
|
|
|
|
local win2 = api.nvim_get_current_win()
|
2022-07-25 01:16:33 -07:00
|
|
|
|
command 'split'
|
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
|
api.nvim_win_set_hl_ns(win1, ns1)
|
|
|
|
|
api.nvim_win_set_hl_ns(win2, ns2)
|
2022-07-25 01:16:33 -07:00
|
|
|
|
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
|
|
|
|
{1:~ }|
|
|
|
|
|
{6:[No Name] }|
|
|
|
|
|
{4: }|
|
|
|
|
|
{5:~ }|
|
|
|
|
|
{7:[No Name] }|
|
|
|
|
|
{2: }|
|
|
|
|
|
{3:~ }|
|
|
|
|
|
{7:[No Name] }|
|
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
2022-08-17 08:38:35 -07:00
|
|
|
|
|
|
|
|
|
it('redraws correctly when ns=0', function()
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*8
|
2022-08-17 08:38:35 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 10:59:57 -07:00
|
|
|
|
api.nvim_set_hl(0, 'EndOfBuffer', { fg = '#333333' })
|
2022-08-17 08:38:35 -07:00
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
^ |
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{8:~ }|*8
|
2022-08-17 08:38:35 -07:00
|
|
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
2023-09-14 06:02:30 -07:00
|
|
|
|
|
|
|
|
|
it('winhl does not accept invalid value #24586', function()
|
2024-10-22 01:10:15 -07:00
|
|
|
|
command('set winhl=Normal:Visual')
|
|
|
|
|
for _, cmd in ipairs({
|
|
|
|
|
[[set winhl='Normal:Wrong']],
|
|
|
|
|
[[set winhl=Normal:Wrong']],
|
|
|
|
|
[[set winhl='Normal:Wrong]],
|
|
|
|
|
}) do
|
|
|
|
|
local res = exec_lua(
|
|
|
|
|
[[
|
|
|
|
|
local _, msg = pcall(vim.api.nvim_command, ...)
|
|
|
|
|
return { msg, vim.wo.winhl }
|
|
|
|
|
]],
|
|
|
|
|
cmd
|
|
|
|
|
)
|
|
|
|
|
eq({
|
|
|
|
|
'Vim(set):E5248: Invalid character in group name',
|
|
|
|
|
'Normal:Visual',
|
|
|
|
|
}, res)
|
|
|
|
|
end
|
2023-09-14 06:02:30 -07:00
|
|
|
|
end)
|
2023-10-03 04:26:11 -07:00
|
|
|
|
|
|
|
|
|
it('Normal in set_hl #25474', function()
|
2023-12-19 09:20:03 -07:00
|
|
|
|
command('highlight Ignore guifg=bg ctermfg=White')
|
2024-01-12 10:59:57 -07:00
|
|
|
|
api.nvim_set_hl(0, 'Normal', { bg = '#333333' })
|
2023-10-03 04:26:11 -07:00
|
|
|
|
command('highlight Ignore')
|
|
|
|
|
screen:expect {
|
|
|
|
|
grid = [[
|
|
|
|
|
|
|
2023-12-09 05:42:00 -07:00
|
|
|
|
{1:~ }|*2
|
2023-10-03 04:26:11 -07:00
|
|
|
|
{6: }|
|
|
|
|
|
|
|
|
|
|
|
Ignore {8:xxx} {9:ctermf}|
|
|
|
|
|
{9:g=}15 {9:guifg=}|
|
|
|
|
|
bg |
|
|
|
|
|
{10:Press ENTER or type comma}|
|
|
|
|
|
{10:nd to continue}^ |
|
|
|
|
|
]],
|
|
|
|
|
}
|
|
|
|
|
end)
|
2017-05-08 09:36:03 -07:00
|
|
|
|
end)
|
2024-03-17 02:24:03 -07:00
|
|
|
|
|
|
|
|
|
describe('synIDattr()', function()
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
command('highlight Normal ctermfg=252 guifg=#ff0000 guibg=Black')
|
|
|
|
|
-- Salmon #fa8072 Maroon #800000
|
|
|
|
|
command(
|
|
|
|
|
'highlight Keyword ctermfg=79 guifg=Salmon guisp=Maroon cterm=strikethrough gui=strikethrough'
|
|
|
|
|
)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('returns cterm-color if RGB-capable UI is _not_ attached', function()
|
|
|
|
|
eq('252', eval('synIDattr(hlID("Normal"), "fg")'))
|
|
|
|
|
eq('252', eval('synIDattr(hlID("Normal"), "fg#")'))
|
|
|
|
|
eq('', eval('synIDattr(hlID("Normal"), "bg")'))
|
|
|
|
|
eq('', eval('synIDattr(hlID("Normal"), "bg#")'))
|
|
|
|
|
eq('79', eval('synIDattr(hlID("Keyword"), "fg")'))
|
|
|
|
|
eq('79', eval('synIDattr(hlID("Keyword"), "fg#")'))
|
|
|
|
|
eq('', eval('synIDattr(hlID("Keyword"), "sp")'))
|
|
|
|
|
eq('', eval('synIDattr(hlID("Keyword"), "sp#")'))
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('returns gui-color if "gui" arg is passed', function()
|
|
|
|
|
eq('Black', eval('synIDattr(hlID("Normal"), "bg", "gui")'))
|
|
|
|
|
eq('Maroon', eval('synIDattr(hlID("Keyword"), "sp", "gui")'))
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('returns gui-color if RGB-capable UI is attached', function()
|
2024-11-11 14:15:19 -07:00
|
|
|
|
local _ = Screen.new(50, 7, { rgb = true })
|
2024-03-17 02:24:03 -07:00
|
|
|
|
eq('#ff0000', eval('synIDattr(hlID("Normal"), "fg")'))
|
|
|
|
|
eq('Black', eval('synIDattr(hlID("Normal"), "bg")'))
|
|
|
|
|
eq('Salmon', eval('synIDattr(hlID("Keyword"), "fg")'))
|
|
|
|
|
eq('Maroon', eval('synIDattr(hlID("Keyword"), "sp")'))
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('returns #RRGGBB value for fg#/bg#/sp#', function()
|
2024-11-11 14:15:19 -07:00
|
|
|
|
local _ = Screen.new(50, 7, { rgb = true })
|
2024-03-17 02:24:03 -07:00
|
|
|
|
eq('#ff0000', eval('synIDattr(hlID("Normal"), "fg#")'))
|
|
|
|
|
eq('#000000', eval('synIDattr(hlID("Normal"), "bg#")'))
|
|
|
|
|
eq('#fa8072', eval('synIDattr(hlID("Keyword"), "fg#")'))
|
|
|
|
|
eq('#800000', eval('synIDattr(hlID("Keyword"), "sp#")'))
|
|
|
|
|
end)
|
|
|
|
|
|
2024-11-11 14:15:19 -07:00
|
|
|
|
it('returns color number if non-RGB GUI', function()
|
|
|
|
|
local _ = Screen.new(50, 7, { rgb = false })
|
2024-03-17 02:24:03 -07:00
|
|
|
|
eq('252', eval('synIDattr(hlID("Normal"), "fg")'))
|
|
|
|
|
eq('79', eval('synIDattr(hlID("Keyword"), "fg")'))
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('returns "1" if group has given highlight attribute', function()
|
|
|
|
|
local hl_attrs = {
|
|
|
|
|
'underline',
|
|
|
|
|
'undercurl',
|
|
|
|
|
'underdouble',
|
|
|
|
|
'underdotted',
|
|
|
|
|
'underdashed',
|
|
|
|
|
'strikethrough',
|
|
|
|
|
}
|
|
|
|
|
for _, hl_attr in ipairs(hl_attrs) do
|
|
|
|
|
local context = 'using ' .. hl_attr .. ' attr'
|
|
|
|
|
command('highlight Keyword cterm=' .. hl_attr .. ' gui=' .. hl_attr)
|
|
|
|
|
eq('', eval('synIDattr(hlID("Normal"), "' .. hl_attr .. '")'), context)
|
|
|
|
|
eq('1', eval('synIDattr(hlID("Keyword"), "' .. hl_attr .. '")'), context)
|
|
|
|
|
eq('1', eval('synIDattr(hlID("Keyword"), "' .. hl_attr .. '", "gui")'), context)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
describe('fg/bg special colors', function()
|
|
|
|
|
before_each(function()
|
|
|
|
|
clear()
|
|
|
|
|
command('highlight Normal ctermfg=145 ctermbg=16 guifg=#ff0000 guibg=Black')
|
|
|
|
|
command('highlight Visual ctermfg=bg ctermbg=fg guifg=bg guibg=fg guisp=bg')
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('resolve to "Normal" values', function()
|
|
|
|
|
eq(eval('synIDattr(hlID("Normal"), "bg")'), eval('synIDattr(hlID("Visual"), "fg")'))
|
|
|
|
|
eq(eval('synIDattr(hlID("Normal"), "bg#")'), eval('synIDattr(hlID("Visual"), "fg#")'))
|
|
|
|
|
eq(eval('synIDattr(hlID("Normal"), "fg")'), eval('synIDattr(hlID("Visual"), "bg")'))
|
|
|
|
|
eq(eval('synIDattr(hlID("Normal"), "fg#")'), eval('synIDattr(hlID("Visual"), "bg#")'))
|
|
|
|
|
eq('bg', eval('synIDattr(hlID("Visual"), "fg", "gui")'))
|
|
|
|
|
eq('bg', eval('synIDattr(hlID("Visual"), "fg#", "gui")'))
|
|
|
|
|
eq('fg', eval('synIDattr(hlID("Visual"), "bg", "gui")'))
|
|
|
|
|
eq('fg', eval('synIDattr(hlID("Visual"), "bg#", "gui")'))
|
|
|
|
|
eq('bg', eval('synIDattr(hlID("Visual"), "sp", "gui")'))
|
|
|
|
|
eq('bg', eval('synIDattr(hlID("Visual"), "sp#", "gui")'))
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('resolve to "Normal" values in RGB-capable UI', function()
|
2024-11-11 14:15:19 -07:00
|
|
|
|
local _ = Screen.new(50, 7, { rgb = true })
|
2024-03-17 02:24:03 -07:00
|
|
|
|
eq('bg', eval('synIDattr(hlID("Visual"), "fg")'))
|
|
|
|
|
eq(eval('synIDattr(hlID("Normal"), "bg#")'), eval('synIDattr(hlID("Visual"), "fg#")'))
|
|
|
|
|
eq('fg', eval('synIDattr(hlID("Visual"), "bg")'))
|
|
|
|
|
eq(eval('synIDattr(hlID("Normal"), "fg#")'), eval('synIDattr(hlID("Visual"), "bg#")'))
|
|
|
|
|
eq('bg', eval('synIDattr(hlID("Visual"), "sp")'))
|
|
|
|
|
eq(eval('synIDattr(hlID("Normal"), "bg#")'), eval('synIDattr(hlID("Visual"), "sp#")'))
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('resolve after the "Normal" group is modified', function()
|
2024-11-11 14:15:19 -07:00
|
|
|
|
local _ = Screen.new(50, 7, { rgb = true })
|
2024-03-17 02:24:03 -07:00
|
|
|
|
local new_guibg = '#282c34'
|
|
|
|
|
local new_guifg = '#abb2bf'
|
|
|
|
|
command('highlight Normal guifg=' .. new_guifg .. ' guibg=' .. new_guibg)
|
|
|
|
|
eq(new_guibg, eval('synIDattr(hlID("Visual"), "fg#")'))
|
|
|
|
|
eq(new_guifg, eval('synIDattr(hlID("Visual"), "bg#")'))
|
|
|
|
|
eq(new_guibg, eval('synIDattr(hlID("Visual"), "sp#")'))
|
|
|
|
|
end)
|
|
|
|
|
end)
|