aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/highlight_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/highlight_spec.lua')
-rw-r--r--test/functional/ui/highlight_spec.lua929
1 files changed, 404 insertions, 525 deletions
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 34a7bc19c6..57d0f2f590 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -32,11 +32,6 @@ describe('highlight: `:syntax manual`', function()
screen = Screen.new(20, 5)
screen:attach()
-- syntax highlight for vimscript's "echo"
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- [1] = { bold = true, foreground = Screen.colors.Brown },
- [2] = { foreground = Screen.colors.Magenta1 },
- })
end)
after_each(function()
@@ -57,8 +52,8 @@ describe('highlight: `:syntax manual`', function()
command('bn')
feed_command('bp')
screen:expect([[
- {1:^echo} {2:1} |
- {0:~ }|*3
+ {15:^echo} {26:1} |
+ {1:~ }|*3
:bp |
]])
end)
@@ -79,8 +74,8 @@ describe('highlight: `:syntax manual`', function()
feed_command('silent bp')
eq('Xtest-functional-ui-highlight.tmp.vim', eval("fnamemodify(bufname('%'), ':t')"))
screen:expect([[
- {1:^echo} {2:1} |
- {0:~ }|*3
+ {15:^echo} {26:1} |
+ {1:~ }|*3
:silent bp |
]])
end)
@@ -92,17 +87,9 @@ describe('highlight defaults', function()
before_each(function()
clear()
screen = Screen.new()
- screen:set_default_attr_ids {
- [0] = { bold = true, foreground = Screen.colors.Blue },
- [1] = { reverse = true, bold = true },
- [2] = { reverse = true },
- [3] = { bold = true },
- [4] = { bold = true, foreground = Screen.colors.SeaGreen },
- [5] = { foreground = Screen.colors.Red1, background = Screen.colors.WebGreen },
- [6] = { background = Screen.colors.Red1, foreground = Screen.colors.Grey100 },
- [7] = { foreground = Screen.colors.Red },
- [8] = { foreground = Screen.colors.Blue },
- [9] = { italic = true },
+ screen:add_extra_attr_ids {
+ [100] = { foreground = Screen.colors.Red, background = Screen.colors.WebGreen },
+ [101] = { italic = true },
}
screen:attach()
end)
@@ -111,10 +98,10 @@ describe('highlight defaults', function()
feed_command('sp', 'vsp', 'vsp')
screen:expect([[
^ │ │ |
- {0:~ }│{0:~ }│{0:~ }|*5
- {1:[No Name] }{2:[No Name] [No Name] }|
+ {1:~ }│{1:~ }│{1:~ }|*5
+ {3:[No Name] }{2:[No Name] [No Name] }|
|
- {0:~ }|*4
+ {1:~ }|*4
{2:[No Name] }|
:vsp |
]])
@@ -122,11 +109,11 @@ describe('highlight defaults', function()
feed('<c-w>j')
screen:expect([[
│ │ |
- {0:~ }│{0:~ }│{0:~ }|*5
+ {1:~ }│{1:~ }│{1:~ }|*5
{2:[No Name] [No Name] [No Name] }|
^ |
- {0:~ }|*4
- {1:[No Name] }|
+ {1:~ }|*4
+ {3:[No Name] }|
:vsp |
]])
-- note that when moving to a window with small width nvim will increase
@@ -135,30 +122,30 @@ describe('highlight defaults', function()
feed('<c-w>k<c-w>l')
screen:expect([[
│^ │ |
- {0:~ }│{0:~ }│{0:~ }|*5
- {2:[No Name] }{1:[No Name] }{2:[No Name] }|
+ {1:~ }│{1:~ }│{1:~ }|*5
+ {2:[No Name] }{3:[No Name] }{2:[No Name] }|
|
- {0:~ }|*4
+ {1:~ }|*4
{2:[No Name] }|
:vsp |
]])
feed('<c-w>l')
screen:expect([[
│ │^ |
- {0:~ }│{0:~ }│{0:~ }|*5
- {2:[No Name] [No Name] }{1:[No Name] }|
+ {1:~ }│{1:~ }│{1:~ }|*5
+ {2:[No Name] [No Name] }{3:[No Name] }|
|
- {0:~ }|*4
+ {1:~ }|*4
{2:[No Name] }|
:vsp |
]])
feed('<c-w>h<c-w>h')
screen:expect([[
^ │ │ |
- {0:~ }│{0:~ }│{0:~ }|*5
- {1:[No Name] }{2:[No Name] [No Name] }|
+ {1:~ }│{1:~ }│{1:~ }|*5
+ {3:[No Name] }{2:[No Name] [No Name] }|
|
- {0:~ }|*4
+ {1:~ }|*4
{2:[No Name] }|
:vsp |
]])
@@ -169,8 +156,8 @@ describe('highlight defaults', function()
screen:try_resize(53, 4)
screen:expect([[
^ |
- {0:~ }|*2
- {3:-- INSERT --} |
+ {1:~ }|*2
+ {5:-- INSERT --} |
]])
end)
@@ -178,7 +165,7 @@ describe('highlight defaults', function()
screen:try_resize(53, 4)
screen:expect([[
^ |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end)
@@ -187,10 +174,10 @@ describe('highlight defaults', function()
screen:try_resize(53, 4)
feed(':ls<cr>')
screen:expect([[
- {1: }|
+ {3: }|
:ls |
1 %a "[No Name]" line 1 |
- {4:Press ENTER or type command to continue}^ |
+ {6:Press ENTER or type command to continue}^ |
]])
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end)
@@ -201,7 +188,7 @@ describe('highlight defaults', function()
feed('i')
screen:expect([[
^ |
- {0:~ }|*2
+ {1:~ }|*2
-- INSERT -- |
]])
feed('<esc>')
@@ -210,8 +197,8 @@ describe('highlight defaults', function()
feed('i')
screen:expect([[
^ |
- {0:~ }|*2
- {5:-- INSERT --} |
+ {1:~ }|*2
+ {100:-- INSERT --} |
]])
end)
@@ -221,8 +208,8 @@ describe('highlight defaults', function()
feed_command('hi link TmpKeyword ErrorMsg')
insert('neovim')
screen:expect([[
- {6:neovi^m} |
- {0:~ }|*2
+ {9:neovi^m} |
+ {1:~ }|*2
|
]])
feed_command(
@@ -231,7 +218,7 @@ describe('highlight defaults', function()
)
screen:expect([[
neovi^m |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end)
@@ -240,19 +227,16 @@ describe('highlight defaults', function()
screen:try_resize(53, 4)
screen:expect([[
^ |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed_command('hi NonTextAlt guifg=Red')
feed_command('hi! link NonText NonTextAlt')
- screen:expect(
- [[
+ screen:expect([[
^ |
- {0:~ }|*2
+ {19:~ }|*2
:hi! link NonText NonTextAlt |
- ]],
- { [0] = { foreground = Screen.colors.Red } }
- )
+ ]])
end)
it('Cursor after `:hi clear|syntax reset` #6508', function()
@@ -266,47 +250,48 @@ describe('highlight defaults', function()
feed_command('set listchars=space:.,tab:>-,trail:*,eol:¬ list')
insert(' ne \t o\tv im ')
screen:expect([[
- ne{7:.>----.}o{7:>-----}v{7:..}im{7:*^*¬} |
- {7:~ }|*2
+ ne{19:.>----.}o{19:>-----}v{19:..}im{19:*^*¬} |
+ {19:~ }|*2
|
]])
feed_command('highlight Whitespace gui=NONE guifg=#0000FF')
screen:expect([[
- ne{8:.>----.}o{8:>-----}v{8:..}im{8:*^*}{7:¬} |
- {7:~ }|*2
+ ne{18:.>----.}o{18:>-----}v{18:..}im{18:*^*}{19:¬} |
+ {19:~ }|*2
:highlight Whitespace gui=NONE guifg=#0000FF |
]])
end)
it('are sent to UIs', function()
screen:try_resize(53, 4)
+
screen:expect {
grid = [[
^ |
- {0:~ }|*2
+ {1:~ }|*2
|
]],
- hl_groups = { EndOfBuffer = 0, MsgSeparator = 1 },
+ hl_groups = { EndOfBuffer = 1, MsgSeparator = 3 },
}
command('highlight EndOfBuffer gui=italic')
screen:expect {
grid = [[
^ |
- {9:~ }|*2
+ {101:~ }|*2
|
]],
- hl_groups = { EndOfBuffer = 9, MsgSeparator = 1 },
+ hl_groups = { EndOfBuffer = 101, MsgSeparator = 3 },
}
command('highlight clear EndOfBuffer')
screen:expect {
grid = [[
^ |
- {0:~ }|*2
+ {1:~ }|*2
|
]],
- hl_groups = { EndOfBuffer = 0, MsgSeparator = 1 },
+ hl_groups = { EndOfBuffer = 1, MsgSeparator = 3 },
}
end)
end)
@@ -317,14 +302,6 @@ describe('highlight', function()
it('Visual', function()
local screen = Screen.new(45, 5)
screen:attach()
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.Black, background = Screen.colors.LightGrey },
- [2] = { bold = true, foreground = Screen.colors.Blue },
- [3] = { bold = true },
- [4] = { reverse = true, bold = true },
- [5] = { reverse = true },
- [6] = { background = Screen.colors.Grey90 },
- })
insert([[
line1 foo bar
abcdefghijklmnopqrs
@@ -337,137 +314,136 @@ describe('highlight', function()
command('set guicursor=a:block-blinkon0')
feed('V')
screen:expect([[
- {1: }^l{1:ine1 foo bar} │{1: line1 foo bar} |
+ {17: }^l{17:ine1 foo bar} │{17: line1 foo bar} |
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL LINE --} |
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ {5:-- VISUAL LINE --} |
]])
feed('<Esc>$vhhh')
screen:expect([[
- line1 foo^ {1:bar} │ line1 foo{1: bar} |
+ line1 foo^ {17:bar} │ line1 foo{17: bar} |
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL --} |
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ {5:-- VISUAL --} |
]])
-- Vertical cursor: highlights char-at-cursor. #8983
command('set guicursor=a:block-blinkon175')
screen:expect([[
- line1 foo{1:^ bar} │ line1 foo{1: bar} |
+ line1 foo{17:^ bar} │ line1 foo{17: bar} |
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL --} |
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ {5:-- VISUAL --} |
]])
command('set selection=exclusive')
screen:expect([[
- line1 foo{1:^ ba}r │ line1 foo{1: ba}r |
+ line1 foo{17:^ ba}r │ line1 foo{17: ba}r |
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL --} |
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ {5:-- VISUAL --} |
]])
feed('o')
screen:expect([[
- line1 foo{1: ba}^r │ line1 foo{1: ba}r |
+ line1 foo{17: ba}^r │ line1 foo{17: ba}r |
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL --} |
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ {5:-- VISUAL --} |
]])
feed('V')
screen:expect([[
- {1: line1 foo ba^r} │{1: line1 foo bar} |
+ {17: line1 foo ba^r} │{17: line1 foo bar} |
abcdefghijklmnopqrs │abcdefghijklmnopqrs |
ABCDEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL LINE --} |
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ {5:-- VISUAL LINE --} |
]])
command('set cursorcolumn')
feed('<C-V>')
screen:expect([[
- line1 foo{1: ba}^r │ line1 foo{1: ba}r |
- abcdefghijklmn{6:o}pqrs │abcdefghijklmnopqrs |
- ABCDEFGHIJKLMN{6:O}PQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL BLOCK --} |
+ 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 --} |
]])
command('set selection&')
screen:expect([[
- line1 foo{1: ba^r} │ line1 foo{1: bar} |
- abcdefghijklmn{6:o}pqrs │abcdefghijklmnopqrs |
- ABCDEFGHIJKLMN{6:O}PQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL BLOCK --} |
+ 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 --} |
]])
feed('^')
screen:expect([[
- {1:^line1 foo }bar │ {1:line1 foo }bar |
- ab{6:c}defghijklmnopqrs │abcdefghijklmnopqrs |
- AB{6:C}DEFGHIJKLMNOPQRS │ABCDEFGHIJKLMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL BLOCK --} |
+ {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 --} |
]])
feed('2j')
screen:expect([[
- {1:line1 foo }bar │ {1:line1 foo }bar |
- ab{1:cdefghijkl}mnopqrs │ab{1:cdefghijkl}mnopqrs |
- AB{1:^CDEFGHIJKL}MNOPQRS │AB{1:CDEFGHIJKL}MNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL BLOCK --} |
+ {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 --} |
]])
command('set nocursorcolumn')
feed('O')
screen:expect([[
- {1:line1 foo }bar │ {1:line1 foo }bar |
- ab{1:cdefghijkl}mnopqrs │ab{1:cdefghijkl}mnopqrs |
- AB{1:CDEFGHIJK^L}MNOPQRS │AB{1:CDEFGHIJKL}MNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL BLOCK --} |
+ {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 --} |
]])
command('set selection=exclusive')
screen:expect([[
- {1:line1 foo} bar │ {1:line1 foo} bar |
- ab{1:cdefghijk}lmnopqrs │ab{1:cdefghijk}lmnopqrs |
- AB{1:CDEFGHIJK}^LMNOPQRS │AB{1:CDEFGHIJK}LMNOPQRS |
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {3:-- VISUAL BLOCK --} |
+ {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 --} |
]])
end)
it('cterm=standout gui=standout', function()
local screen = Screen.new(20, 5)
screen:attach()
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Blue1 },
- [2] = {
- standout = true,
+ screen:add_extra_attr_ids {
+ [100] = {
+ foreground = Screen.colors.Blue1,
bold = true,
+ background = Screen.colors.Grey90,
underline = true,
- background = Screen.colors.Gray90,
- foreground = Screen.colors.Blue1,
+ standout = true,
},
- [3] = { standout = true, underline = true, background = Screen.colors.Gray90 },
- })
+ [101] = { underline = true, standout = true, background = Screen.colors.Grey90 },
+ }
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:*¬} |
- {2:^>-------.}{3:abcd}{2:*¬}{3: }|
+ {100:^>-------.}{101:abcd}{100:*¬}{101: }|
{1:¬} |
{1:~ }|
|
@@ -504,16 +480,13 @@ describe('highlight', function()
it('nocombine', function()
local screen = Screen.new(25, 6)
- screen:set_default_attr_ids {
- [1] = { foreground = Screen.colors.SlateBlue, underline = true },
- [2] = { bold = true, foreground = Screen.colors.Blue1 },
- [3] = { underline = true, reverse = true, foreground = Screen.colors.SlateBlue },
- [4] = {
- background = Screen.colors.Yellow,
- reverse = true,
+ screen:add_extra_attr_ids {
+ [100] = { underline = true, reverse = true, foreground = Screen.colors.SlateBlue },
+ [101] = {
foreground = Screen.colors.SlateBlue,
+ reverse = true,
+ background = Screen.colors.Yellow,
},
- [5] = { foreground = Screen.colors.Red },
}
screen:attach()
feed_command('syntax on')
@@ -526,9 +499,9 @@ describe('highlight', function()
]])
screen:expect {
grid = [[
- {1:foobar} |*2
+ {28:foobar} |*2
^ |
- {2:~ }|*2
+ {1:~ }|*2
|
]],
}
@@ -536,21 +509,21 @@ describe('highlight', function()
feed('/foo')
screen:expect {
grid = [[
- {3:foo}{1:bar} |
- {4:foo}{1:bar} |
+ {100:foo}{28:bar} |
+ {101:foo}{28:bar} |
|
- {2:~ }|*2
+ {1:~ }|*2
/foo^ |
]],
}
feed('<cr>')
screen:expect {
grid = [[
- {4:^foo}{1:bar} |
- {4:foo}{1:bar} |
+ {101:^foo}{28:bar} |
+ {101:foo}{28:bar} |
|
- {2:~ }|*2
- {5:search hit...uing at TOP} |
+ {1:~ }|*2
+ {19:search hit...uing at TOP} |
]],
}
end)
@@ -660,44 +633,40 @@ describe("'listchars' highlight", function()
end)
it("'cursorline' and 'cursorcolumn'", function()
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- [1] = { background = Screen.colors.Grey90 },
- })
feed_command('highlight clear ModeMsg')
feed_command('set cursorline')
feed('i')
screen:expect([[
- {1:^ }|
- {0:~ }|*3
+ {21:^ }|
+ {1:~ }|*3
-- INSERT -- |
]])
feed('abcdefg<cr>kkasdf')
screen:expect([[
abcdefg |
- {1:kkasdf^ }|
- {0:~ }|*2
+ {21:kkasdf^ }|
+ {1:~ }|*2
-- INSERT -- |
]])
feed('<esc>')
screen:expect([[
abcdefg |
- {1:kkasd^f }|
- {0:~ }|*2
+ {21:kkasd^f }|
+ {1:~ }|*2
|
]])
feed_command('set nocursorline')
screen:expect([[
abcdefg |
kkasd^f |
- {0:~ }|*2
+ {1:~ }|*2
:set nocursorline |
]])
feed('k')
screen:expect([[
abcde^fg |
kkasdf |
- {0:~ }|*2
+ {1:~ }|*2
:set nocursorline |
]])
feed('jjji<cr><cr><cr><esc>')
@@ -711,42 +680,27 @@ describe("'listchars' highlight", function()
feed_command('set cursorcolumn')
feed('kkiabcdefghijk<esc>hh')
screen:expect([[
- kkasd {1: } |
- {1:abcdefgh^ijk }|
- {1: } |
- f {1: } |
+ kkasd {21: } |
+ {21:abcdefgh^ijk }|
+ {21: } |
+ f {21: } |
|
]])
feed('khh')
screen:expect([[
- {1:kk^asd }|
- ab{1:c}defghijk |
- {1: } |
- f {1: } |
+ {21:kk^asd }|
+ ab{21:c}defghijk |
+ {21: } |
+ f {21: } |
|
]])
end)
it("'cursorline' and with 'listchars' option", function()
- screen:set_default_attr_ids({
- [1] = { background = Screen.colors.Grey90 },
- [2] = {
- foreground = Screen.colors.Red,
- background = Screen.colors.Grey90,
- },
- [3] = {
- background = Screen.colors.Grey90,
- foreground = Screen.colors.Blue,
- bold = true,
- },
- [4] = {
- foreground = Screen.colors.Blue,
- bold = true,
- },
- [5] = {
- foreground = Screen.colors.Red,
- },
- })
+ 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 },
+ }
feed_command('highlight clear ModeMsg')
feed_command('highlight Whitespace guifg=#FF0000')
feed_command('set cursorline')
@@ -754,73 +708,70 @@ describe("'listchars' highlight", function()
feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
feed('i\t abcd <cr>\t abcd <cr><esc>k')
screen:expect([[
- {5:>-------.}abcd{5:*}{4:¬} |
- {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
- {4:¬} |
- {4:~ }|
+ {19:>-------.}abcd{19:*}{1:¬} |
+ {100:^>-------.}{21:abcd}{100:*}{101:¬}{21: }|
+ {1:¬} |
+ {1:~ }|
|
]])
feed('k')
screen:expect([[
- {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
- {5:>-------.}abcd{5:*}{4:¬} |
- {4:¬} |
- {4:~ }|
+ {100:^>-------.}{21:abcd}{100:*}{101:¬}{21: }|
+ {19:>-------.}abcd{19:*}{1:¬} |
+ {1:¬} |
+ {1:~ }|
|
]])
feed_command('set nocursorline')
screen:expect([[
- {5:^>-------.}abcd{5:*}{4:¬} |
- {5:>-------.}abcd{5:*}{4:¬} |
- {4:¬} |
- {4:~ }|
+ {19:^>-------.}abcd{19:*}{1:¬} |
+ {19:>-------.}abcd{19:*}{1:¬} |
+ {1:¬} |
+ {1:~ }|
:set nocursorline |
]])
feed_command('set nowrap')
feed('ALorem ipsum dolor sit amet<ESC>0')
screen:expect([[
- {5:^>-------.}abcd{5:.}Lorem{4:>}|
- {5:>-------.}abcd{5:*}{4:¬} |
- {4:¬} |
- {4:~ }|
+ {19:^>-------.}abcd{19:.}Lorem{1:>}|
+ {19:>-------.}abcd{19:*}{1:¬} |
+ {1:¬} |
+ {1:~ }|
|
]])
feed_command('set cursorline')
screen:expect([[
- {2:^>-------.}{1:abcd}{2:.}{1:Lorem}{3:>}|
- {5:>-------.}abcd{5:*}{4:¬} |
- {4:¬} |
- {4:~ }|
+ {100:^>-------.}{21:abcd}{100:.}{21:Lorem}{101:>}|
+ {19:>-------.}abcd{19:*}{1:¬} |
+ {1:¬} |
+ {1:~ }|
:set cursorline |
]])
feed('$')
screen:expect([[
- {3:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }|
- {4:<} |*2
- {4:~ }|
+ {101:<}{21:r}{100:.}{21:sit}{100:.}{21:ame^t}{101:¬}{21: }|
+ {1:<} |*2
+ {1:~ }|
:set cursorline |
]])
feed('G')
screen:expect([[
- {5:>-------.}abcd{5:.}Lorem{4:>}|
- {5:>-------.}abcd{5:*}{4:¬} |
- {3:^¬}{1: }|
- {4:~ }|
+ {19:>-------.}abcd{19:.}Lorem{1:>}|
+ {19:>-------.}abcd{19:*}{1:¬} |
+ {101:^¬}{21: }|
+ {1:~ }|
:set cursorline |
]])
end)
it("'listchar' with wrap", function()
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- })
feed_command('set wrap')
feed_command('set listchars=eol:¬,precedes:< list')
feed('90ia<esc>')
screen:expect([[
- {0:<}aaaaaaaaaaaaaaaaaaa|
+ {1:<}aaaaaaaaaaaaaaaaaaa|
aaaaaaaaaaaaaaaaaaaa|*2
- aaaaaaaaa^a{0:¬} |
+ aaaaaaaaa^a{1:¬} |
|
]])
feed('0')
@@ -832,16 +783,16 @@ describe("'listchars' highlight", function()
end)
it("'listchar' in visual mode", function()
- screen:set_default_attr_ids({
- [1] = { background = Screen.colors.Grey90 },
- [2] = { foreground = Screen.colors.Red, background = Screen.colors.Grey90 },
- [3] = { background = Screen.colors.Grey90, foreground = Screen.colors.Blue, bold = true },
- [4] = { foreground = Screen.colors.Blue, bold = true },
- [5] = { foreground = Screen.colors.Red },
- [6] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black },
- [7] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Red },
- [8] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Blue, bold = true },
- })
+ 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 },
+ }
command('highlight clear ModeMsg')
command('highlight Whitespace guifg=#FF0000')
command('set cursorline')
@@ -850,45 +801,42 @@ describe("'listchars' highlight", function()
command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
feed('i\t abcd <cr>\t abcd Lorem ipsum dolor sit amet<cr><esc>kkk0')
screen:expect([[
- {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
- {5:>-------.}abcd{5:.}Lorem{4:>}|
- {4:¬} |
- {4:~ }|
+ {101:^>-------.}{21:abcd}{101:*}{102:¬}{21: }|
+ {19:>-------.}abcd{19:.}Lorem{1:>}|
+ {1:¬} |
+ {1:~ }|
|
]])
feed('lllvj')
screen:expect([[
- {5:>-------.}a{6:bcd}{7:*}{8:¬} |
- {7:>-------.}{6:a}^bcd{5:.}Lorem{4:>}|
- {4:¬} |
- {4:~ }|
+ {19:>-------.}a{17:bcd}{103:*}{100:¬} |
+ {103:>-------.}{17:a}^bcd{19:.}Lorem{1:>}|
+ {1:¬} |
+ {1:~ }|
-- VISUAL -- |
]])
feed('<esc>V')
screen:expect([[
- {5:>-------.}abcd{5:*}{4:¬} |
- {7:>-------.}{6:a}^b{6:cd}{7:.}{6:Lorem}{4:>}|
- {4:¬} |
- {4:~ }|
+ {19:>-------.}abcd{19:*}{1:¬} |
+ {103:>-------.}{17:a}^b{17:cd}{103:.}{17:Lorem}{1:>}|
+ {1:¬} |
+ {1:~ }|
-- VISUAL LINE -- |
]])
feed('<esc>$')
screen:expect([[
- {4:<} |
- {3:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }|
- {4:<} |
- {4:~ }|
+ {1:<} |
+ {102:<}{21:r}{101:.}{21:sit}{101:.}{21:ame^t}{102:¬}{21: }|
+ {1:<} |
+ {1:~ }|
|
]])
end)
it("'cursorline' with :match", function()
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- [1] = { background = Screen.colors.Grey90 },
- [2] = { foreground = Screen.colors.Red },
- [3] = { foreground = Screen.colors.X11Green, background = Screen.colors.Red1 },
- })
+ screen:add_extra_attr_ids {
+ [100] = { foreground = Screen.colors.Lime, background = Screen.colors.Red },
+ }
feed_command('highlight clear ModeMsg')
feed_command('highlight Whitespace guifg=#FF0000')
feed_command('highlight Error guifg=#00FF00')
@@ -896,19 +844,19 @@ describe("'listchars' highlight", function()
feed('ia \t bc \t <esc>')
screen:expect([[
a bc ^ |
- {0:~ }|*3
+ {1:~ }|*3
|
]])
feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
screen:expect([[
- a{2:.>-----.}bc{2:*>---*^*}{0:¬} |
- {0:~ }|*3
+ a{19:.>-----.}bc{19:*>---*^*}{1:¬} |
+ {1:~ }|*3
|
]])
feed_command('match Error /\\s\\+$/')
screen:expect([[
- a{2:.>-----.}bc{3:*>---*^*}{0:¬} |
- {0:~ }|*3
+ a{19:.>-----.}bc{100:*>---*^*}{1:¬} |
+ {1:~ }|*3
|
]])
end)
@@ -919,15 +867,10 @@ describe('CursorLine and CursorLineNr highlights', function()
it('overridden by Error, ColorColumn if fg not set', function()
local screen = Screen.new(50, 5)
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.SlateBlue },
- [2] = { bold = true, foreground = Screen.colors.Brown },
- [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [4] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90 },
- [5] = { background = Screen.colors.Gray90 },
- [6] = { bold = true, foreground = Screen.colors.Blue1 },
- [7] = { background = Screen.colors.LightRed },
- })
+ screen:add_extra_attr_ids {
+ [100] = { background = Screen.colors.LightRed },
+ [101] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
+ }
screen:attach()
command('filetype on')
@@ -935,32 +878,32 @@ describe('CursorLine and CursorLineNr highlights', function()
command('set cursorline ft=json')
feed('i{<cr>"a" : abc // 10;<cr>}<cr><esc>')
screen:expect([[
- {1:{} |
- "{2:a}" : {3:abc} {3:// 10;} |
- {1:}} |
- {5:^ }|
+ {16:{} |
+ "{15:a}" : {9:abc} {9:// 10;} |
+ {16:}} |
+ {21:^ }|
|
]])
command('set colorcolumn=3')
feed('i <esc>')
screen:expect([[
- {1:{} {7: } |
- "{2:a}{7:"} : {3:abc} {3:// 10;} |
- {1:}} {7: } |
- {5: ^ }{7: }{5: }|
+ {16:{} {100: } |
+ "{15:a}{100:"} : {9:abc} {9:// 10;} |
+ {16:}} {100: } |
+ {21: ^ }{100: }{21: }|
|
]])
end)
it("overridden by NonText in 'showbreak' characters", function()
local screen = Screen.new(20, 5)
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.Yellow, background = Screen.colors.Blue },
- [2] = { foreground = Screen.colors.Black, background = Screen.colors.White },
- [3] = { foreground = Screen.colors.Yellow, background = Screen.colors.White },
- [4] = { foreground = Screen.colors.Yellow },
- })
+ 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 },
+ }
screen:attach()
feed_command('set wrap cursorline')
@@ -973,46 +916,45 @@ describe('CursorLine and CursorLineNr highlights', function()
feed('30iø<esc>o<esc>30ia<esc>')
screen:expect([[
øøøøøøøøøøøøøøøøøøøø|
- {1:>>>}øøøøøøøøøø |
- {2:aaaaaaaaaaaaaaaaaaaa}|
- {1:>>>}{2:aaaaaaaaa^a }|
+ {101:>>>}øøøøøøøøøø |
+ {102:aaaaaaaaaaaaaaaaaaaa}|
+ {101:>>>}{102:aaaaaaaaa^a }|
|
]])
feed('k')
screen:expect([[
- {2:øøøøøøøøøøøøøøøøøøøø}|
- {1:>>>}{2:øøøøøøøøø^ø }|
+ {102:øøøøøøøøøøøøøøøøøøøø}|
+ {101:>>>}{102:øøøøøøøøø^ø }|
aaaaaaaaaaaaaaaaaaaa|
- {1:>>>}aaaaaaaaaa |
+ {101:>>>}aaaaaaaaaa |
|
]])
feed_command('highlight NonText guibg=NONE')
screen:expect([[
- {2:øøøøøøøøøøøøøøøøøøøø}|
- {3:>>>}{2:øøøøøøøøø^ø }|
+ {102:øøøøøøøøøøøøøøøøøøøø}|
+ {103:>>>}{102:øøøøøøøøø^ø }|
aaaaaaaaaaaaaaaaaaaa|
- {4:>>>}aaaaaaaaaa |
+ {100:>>>}aaaaaaaaaa |
|
]])
feed_command('set nocursorline')
screen:expect([[
øøøøøøøøøøøøøøøøøøøø|
- {4:>>>}øøøøøøøøø^ø |
+ {100:>>>}øøøøøøøøø^ø |
aaaaaaaaaaaaaaaaaaaa|
- {4:>>>}aaaaaaaaaa |
+ {100:>>>}aaaaaaaaaa |
:set nocursorline |
]])
end)
it("'cursorlineopt' screenline", function()
local screen = Screen.new(20, 5)
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.Black, background = Screen.colors.White },
- [2] = { foreground = Screen.colors.Yellow },
- [3] = { foreground = Screen.colors.Red, background = Screen.colors.Green },
- [4] = { foreground = Screen.colors.Green, background = Screen.colors.Red },
- [5] = { bold = true }, -- ModeMsg
- })
+ 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 },
+ }
screen:attach()
command('set wrap cursorline cursorlineopt=screenline')
@@ -1029,107 +971,107 @@ describe('CursorLine and CursorLineNr highlights', function()
-- CursorLine should not apply to 'showbreak' when 'cursorlineopt' contains "screenline"
screen:expect([[
øøøøøøøøøøøøøøøøøøøø|
- {2:>>>}øøøøøøøøøø |
+ {100:>>>}øøøøøøøøøø |
aaaaaaaaaaaaaaaaaaaa|
- {2:>>>}{1:aaaaaaaaa^a }|
+ {100:>>>}{102:aaaaaaaaa^a }|
|
]])
feed('gk')
screen:expect([[
øøøøøøøøøøøøøøøøøøøø|
- {2:>>>}øøøøøøøøøø |
- {1:aaaaaaaaaaaa^aaaaaaaa}|
- {2:>>>}aaaaaaaaaa |
+ {100:>>>}øøøøøøøøøø |
+ {102:aaaaaaaaaaaa^aaaaaaaa}|
+ {100:>>>}aaaaaaaaaa |
|
]])
feed('k')
screen:expect([[
- {1:øøøøøøøøøøøø^øøøøøøøø}|
- {2:>>>}øøøøøøøøøø |
+ {102:øøøøøøøøøøøø^øøøøøøøø}|
+ {100:>>>}øøøøøøøøøø |
aaaaaaaaaaaaaaaaaaaa|
- {2:>>>}aaaaaaaaaa |
+ {100:>>>}aaaaaaaaaa |
|
]])
-- CursorLineNr should not apply to line number when 'cursorlineopt' does not contain "number"
command('set relativenumber numberwidth=2')
screen:expect([[
- {3:0 }{1:øøøøøøøøøøøø^øøøøøø}|
- {3: }{2:>>>}øøøøøøøøøøøø |
- {3:1 }aaaaaaaaaaaaaaaaaa|
- {3: }{2:>>>}aaaaaaaaaaaa |
+ {101:0 }{102:øøøøøøøøøøøø^øøøøøø}|
+ {101: }{100:>>>}øøøøøøøøøøøø |
+ {101:1 }aaaaaaaaaaaaaaaaaa|
+ {101: }{100:>>>}aaaaaaaaaaaa |
|
]])
-- CursorLineNr should apply to line number when 'cursorlineopt' contains "number"
command('set cursorlineopt+=number')
screen:expect([[
- {4:0 }{1:øøøøøøøøøøøø^øøøøøø}|
- {3: }{2:>>>}øøøøøøøøøøøø |
- {3:1 }aaaaaaaaaaaaaaaaaa|
- {3: }{2:>>>}aaaaaaaaaaaa |
+ {103:0 }{102:øøøøøøøøøøøø^øøøøøø}|
+ {101: }{100:>>>}øøøøøøøøøøøø |
+ {101:1 }aaaaaaaaaaaaaaaaaa|
+ {101: }{100:>>>}aaaaaaaaaaaa |
|
]])
feed('gj')
screen:expect([[
- {4:0 }øøøøøøøøøøøøøøøøøø|
- {3: }{2:>>>}{1:øøøøøøøøø^øøø }|
- {3:1 }aaaaaaaaaaaaaaaaaa|
- {3: }{2:>>>}aaaaaaaaaaaa |
+ {103:0 }øøøøøøøøøøøøøøøøøø|
+ {101: }{100:>>>}{102:øøøøøøøøø^øøø }|
+ {101:1 }aaaaaaaaaaaaaaaaaa|
+ {101: }{100:>>>}aaaaaaaaaaaa |
|
]])
feed('gj')
screen:expect([[
- {3:1 }øøøøøøøøøøøøøøøøøø|
- {3: }{2:>>>}øøøøøøøøøøøø |
- {4:0 }{1:aaaaaaaaaaaa^aaaaaa}|
- {3: }{2:>>>}aaaaaaaaaaaa |
+ {101:1 }øøøøøøøøøøøøøøøøøø|
+ {101: }{100:>>>}øøøøøøøøøøøø |
+ {103:0 }{102:aaaaaaaaaaaa^aaaaaa}|
+ {101: }{100:>>>}aaaaaaaaaaaa |
|
]])
feed('gj')
screen:expect([[
- {3:1 }øøøøøøøøøøøøøøøøøø|
- {3: }{2:>>>}øøøøøøøøøøøø |
- {4:0 }aaaaaaaaaaaaaaaaaa|
- {3: }{2:>>>}{1:aaaaaaaaa^aaa }|
+ {101:1 }øøøøøøøøøøøøøøøøøø|
+ {101: }{100:>>>}øøøøøøøøøøøø |
+ {103:0 }aaaaaaaaaaaaaaaaaa|
+ {101: }{100:>>>}{102:aaaaaaaaa^aaa }|
|
]])
-- updated in Insert mode
feed('I')
screen:expect([[
- {3:1 }øøøøøøøøøøøøøøøøøø|
- {3: }{2:>>>}øøøøøøøøøøøø |
- {4:0 }{1:^aaaaaaaaaaaaaaaaaa}|
- {3: }{2:>>>}aaaaaaaaaaaa |
+ {101:1 }øøøøøøøøøøøøøøøøøø|
+ {101: }{100:>>>}øøøøøøøøøøøø |
+ {103:0 }{102:^aaaaaaaaaaaaaaaaaa}|
+ {101: }{100:>>>}aaaaaaaaaaaa |
{5:-- INSERT --} |
]])
feed('<Esc>gg')
screen:expect([[
- {4:0 }{1:^øøøøøøøøøøøøøøøøøø}|
- {3: }{2:>>>}øøøøøøøøøøøø |
- {3:1 }aaaaaaaaaaaaaaaaaa|
- {3: }{2:>>>}aaaaaaaaaaaa |
+ {103:0 }{102:^øøøøøøøøøøøøøøøøøø}|
+ {101: }{100:>>>}øøøøøøøøøøøø |
+ {101:1 }aaaaaaaaaaaaaaaaaa|
+ {101: }{100:>>>}aaaaaaaaaaaa |
|
]])
command('inoremap <F2> <Cmd>call cursor(1, 1)<CR>')
feed('A')
screen:expect([[
- {4:0 }øøøøøøøøøøøøøøøøøø|
- {3: }{2:>>>}{1:øøøøøøøøøøøø^ }|
- {3:1 }aaaaaaaaaaaaaaaaaa|
- {3: }{2:>>>}aaaaaaaaaaaa |
+ {103:0 }øøøøøøøøøøøøøøøøøø|
+ {101: }{100:>>>}{102:øøøøøøøøøøøø^ }|
+ {101:1 }aaaaaaaaaaaaaaaaaa|
+ {101: }{100:>>>}aaaaaaaaaaaa |
{5:-- INSERT --} |
]])
feed('<F2>')
screen:expect([[
- {4:0 }{1:^øøøøøøøøøøøøøøøøøø}|
- {3: }{2:>>>}øøøøøøøøøøøø |
- {3:1 }aaaaaaaaaaaaaaaaaa|
- {3: }{2:>>>}aaaaaaaaaaaa |
+ {103:0 }{102:^øøøøøøøøøøøøøøøøøø}|
+ {101: }{100:>>>}øøøøøøøøøøøø |
+ {101:1 }aaaaaaaaaaaaaaaaaa|
+ {101: }{100:>>>}aaaaaaaaaaaa |
{5:-- INSERT --} |
]])
end)
@@ -1137,22 +1079,16 @@ describe('CursorLine and CursorLineNr highlights', function()
-- oldtest: Test_cursorline_after_yank()
it('always updated. vim-patch:8.1.0849', function()
local screen = Screen.new(50, 5)
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.SlateBlue },
- [2] = { bold = true, foreground = Screen.colors.Brown },
- [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [4] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90 },
- [5] = { background = Screen.colors.Gray90 },
- [6] = { bold = true, foreground = Screen.colors.Blue1 },
- [7] = { background = Screen.colors.LightRed },
- [8] = { foreground = Screen.colors.Brown },
- })
+ screen:add_extra_attr_ids {
+ [100] = { background = Screen.colors.LightRed },
+ [101] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
+ }
screen:attach()
command('set cursorline relativenumber')
command('call setline(1, ["","1","2","3",""])')
feed('Gy3k')
screen:expect([[
- {2: 0 }{5:^1 }|
+ {15: 0 }{21:^1 }|
{8: 1 }2 |
{8: 2 }3 |
{8: 3 } |
@@ -1162,7 +1098,7 @@ describe('CursorLine and CursorLineNr highlights', function()
screen:expect([[
{8: 2 }1 |
{8: 1 }2 |
- {2: 0 }{5:^3 }|
+ {15: 0 }{21:^3 }|
{8: 1 } |
4 lines yanked |
]])
@@ -1171,37 +1107,25 @@ describe('CursorLine and CursorLineNr highlights', function()
-- oldtest: Test_cursorline_with_visualmode()
it('with visual area. vim-patch:8.1.1001', function()
local screen = Screen.new(50, 5)
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.SlateBlue },
- [2] = { bold = true, foreground = Screen.colors.Brown },
- [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [4] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90 },
- [5] = { background = Screen.colors.Gray90 },
- [6] = { bold = true, foreground = Screen.colors.Blue1 },
- [7] = { background = Screen.colors.LightRed },
- [8] = { foreground = Screen.colors.Brown },
- [9] = { foreground = Screen.colors.Black, background = Screen.colors.LightGrey },
- [10] = { bold = true },
- })
+ screen:add_extra_attr_ids {
+ [100] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
+ [101] = { background = Screen.colors.LightRed },
+ }
screen:attach()
command('set cursorline')
command('call setline(1, repeat(["abc"], 50))')
feed('V<C-f>zbkkjk')
screen:expect([[
- {9:abc} |
- ^a{9:bc} |
+ {17:abc} |
+ ^a{17:bc} |
abc |*2
- {10:-- VISUAL LINE --} |
+ {5:-- VISUAL LINE --} |
]])
end)
-- oldtest: Test_cursorline_callback()
it('is updated if cursor is moved up from timer vim-patch:8.2.4591', function()
local screen = Screen.new(50, 8)
- screen:set_default_attr_ids({
- [1] = { background = Screen.colors.Gray90 }, -- CursorLine
- [2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
- })
screen:attach()
exec([[
call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
@@ -1219,8 +1143,8 @@ describe('CursorLine and CursorLineNr highlights', function()
aaaaa |
bbbbb |
ccccc |
- {1:^ddddd }|
- {2:~ }|*3
+ {21:^ddddd }|
+ {1:~ }|*3
|
]],
timeout = 100,
@@ -1228,10 +1152,10 @@ describe('CursorLine and CursorLineNr highlights', function()
screen:expect({
grid = [[
aaaaa |
- {1:^bbbbb }|
+ {21:^bbbbb }|
ccccc |
ddddd |
- {2:~ }|*3
+ {1:~ }|*3
|
]],
})
@@ -1239,17 +1163,10 @@ describe('CursorLine and CursorLineNr highlights', function()
it('with split windows in diff mode', function()
local screen = Screen.new(50, 12)
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray },
- [2] = { bold = true, background = Screen.colors.Red },
- [3] = { background = Screen.colors.LightMagenta },
- [4] = { reverse = true },
- [5] = { background = Screen.colors.LightBlue },
- [6] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 },
- [7] = { background = Screen.colors.Red, foreground = Screen.colors.White },
- [8] = { bold = true, foreground = Screen.colors.Blue1 },
- [9] = { bold = true, reverse = true },
- })
+ screen:add_extra_attr_ids {
+ [100] = { background = Screen.colors.Plum1, underline = true },
+ [101] = { background = Screen.colors.Red1, bold = true, underline = true },
+ }
screen:attach()
command('hi CursorLine ctermbg=red ctermfg=white guibg=red guifg=white')
@@ -1264,26 +1181,26 @@ describe('CursorLine and CursorLineNr highlights', function()
feed('<esc>gg')
command('windo diffthis')
screen:expect([[
- {1: }{7:line 1 some text }│{1: }{7:^line 1 some text }|
- {1: }{3:line 2 mo}{2:Re text!}{3: }│{1: }{3:line 2 mo}{2:re text}{3: }|
- {1: }{5:extra line! }│{1: }{6:----------------------}|
- {1: }extra line! │{1: }extra line! |*2
- {1: }last line ... │{1: }last line ... |
- {1: } │{1: } |
- {8:~ }│{8:~ }|*3
- {4:[No Name] [+] }{9:[No Name] [+] }|
+ {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] [+] }|
|
]])
feed('jjjjj')
screen:expect([[
- {1: }line 1 some text │{1: }line 1 some text |
- {1: }{3:line 2 mo}{2:Re text!}{3: }│{1: }{3:line 2 mo}{2:re text}{3: }|
- {1: }{5:extra line! }│{1: }{6:----------------------}|
- {1: }extra line! │{1: }extra line! |*2
- {1: }last line ... │{1: }last line ... |
- {1: }{7: }│{1: }{7:^ }|
- {8:~ }│{8:~ }|*3
- {4:[No Name] [+] }{9:[No Name] [+] }|
+ {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] [+] }|
|
]])
@@ -1291,53 +1208,25 @@ describe('CursorLine and CursorLineNr highlights', function()
-- Rendered as underline in a diff-line. #9028
command('hi CursorLine ctermbg=red ctermfg=NONE guibg=red guifg=NONE')
feed('kkkk')
- screen:expect(
- [[
- {1: }line 1 some text │{1: }line 1 some text |
- {1: }{11:line 2 mo}{12:Re text!}{11: }│{1: }{11:^line 2 mo}{12:re text}{11: }|
- {1: }{5:extra line! }│{1: }{6:----------------------}|
- {1: }extra line! │{1: }extra line! |*2
- {1: }last line ... │{1: }last line ... |
- {1: } │{1: } |
- {8:~ }│{8:~ }|*3
- {4:[No Name] [+] }{9:[No Name] [+] }|
+ 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] [+] }|
|
- ]],
- {
- [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray },
- [2] = { bold = true, background = Screen.colors.Red },
- [3] = { background = Screen.colors.LightMagenta },
- [4] = { reverse = true },
- [5] = { background = Screen.colors.LightBlue },
- [6] = {
- background = Screen.colors.LightCyan1,
- bold = true,
- foreground = Screen.colors.Blue1,
- },
- [7] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [8] = { bold = true, foreground = Screen.colors.Blue1 },
- [9] = { bold = true, reverse = true },
- [10] = { bold = true },
- [11] = { underline = true, background = Screen.colors.LightMagenta },
- [12] = { bold = true, underline = true, background = Screen.colors.Red },
- }
- )
+ ]])
end)
-- oldtest: Test_diff_with_cursorline_number()
it('CursorLineNr shows correctly just below filler lines', function()
local screen = Screen.new(50, 12)
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray },
- [2] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 },
- [3] = { reverse = true },
- [4] = { background = Screen.colors.LightBlue },
- [5] = { background = Screen.colors.Red, foreground = Screen.colors.White },
- [6] = { background = Screen.colors.White, bold = true, foreground = Screen.colors.Black },
- [7] = { bold = true, foreground = Screen.colors.Blue1 },
- [8] = { bold = true, reverse = true },
- [9] = { foreground = Screen.colors.Brown },
- })
+ screen:add_extra_attr_ids {
+ [100] = { foreground = Screen.colors.Black, bold = true, background = Screen.colors.Grey100 },
+ }
screen:attach()
command('hi CursorLine guibg=red guifg=white')
@@ -1350,22 +1239,22 @@ describe('CursorLine and CursorLineNr highlights', function()
command('windo diffthis')
command('1wincmd w')
screen:expect([[
- {1: }{9: }{2:-------------------}│{1: }{9: 1 }{4:baz }|
- {1: }{6: 1 }{5:^foo }│{1: }{6: 2 }{5:foo }|
- {1: }{9: 2 }foo │{1: }{9: 3 }foo |
- {1: }{9: 3 }bar │{1: }{9: 4 }bar |
- {7:~ }│{7:~ }|*6
- {8:[No Name] [+] }{3:[No Name] [+] }|
+ {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] [+] }|
|
]])
command('set cursorlineopt=number')
screen:expect([[
- {1: }{9: }{2:-------------------}│{1: }{9: 1 }{4:baz }|
- {1: }{6: 1 }^foo │{1: }{6: 2 }{5:foo }|
- {1: }{9: 2 }foo │{1: }{9: 3 }foo |
- {1: }{9: 3 }bar │{1: }{9: 4 }bar |
- {7:~ }│{7:~ }|*6
- {8:[No Name] [+] }{3:[No Name] [+] }|
+ {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] [+] }|
|
]])
end)
@@ -1376,13 +1265,9 @@ describe('CursorColumn highlight', function()
before_each(function()
clear()
screen = Screen.new(50, 8)
- screen:set_default_attr_ids({
- [1] = { background = Screen.colors.Gray90 }, -- CursorColumn
- [2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
- [3] = { bold = true }, -- ModeMsg
- [4] = { background = Screen.colors.Red },
- [5] = { background = Screen.colors.Blue },
- })
+ screen:add_extra_attr_ids {
+ [100] = { background = Screen.colors.Blue1 },
+ }
screen:attach()
end)
@@ -1393,31 +1278,31 @@ describe('CursorColumn highlight', function()
call cursor(2, 2)
]])
screen:expect([[
- 1234567{1:8}9 |
+ 1234567{21:8}9 |
a ^ b |
- {2:~ }|*5
+ {1:~ }|*5
|
]])
feed('i')
screen:expect([[
- 1{1:2}3456789 |
+ 1{21:2}3456789 |
a^ b |
- {2:~ }|*5
- {3:-- INSERT --} |
+ {1:~ }|*5
+ {5:-- INSERT --} |
]])
feed('<C-O>')
screen:expect([[
- 1234567{1:8}9 |
+ 1234567{21:8}9 |
a ^ b |
- {2:~ }|*5
- {3:-- (insert) --} |
+ {1:~ }|*5
+ {5:-- (insert) --} |
]])
feed('i')
screen:expect([[
- 1{1:2}3456789 |
+ 1{21:2}3456789 |
a^ b |
- {2:~ }|*5
- {3:-- INSERT --} |
+ {1:~ }|*5
+ {5:-- INSERT --} |
]])
end)
@@ -1436,11 +1321,11 @@ describe('CursorColumn highlight', function()
]])
screen:expect({
grid = [[
- aaaa{1:a} |
- bbbb{1:b} |
- cccc{1:c} |
+ aaaa{21:a} |
+ bbbb{21:b} |
+ cccc{21:c} |
dddd^d |
- {2:~ }|*3
+ {1:~ }|*3
|
]],
timeout = 100,
@@ -1448,10 +1333,10 @@ describe('CursorColumn highlight', function()
screen:expect({
grid = [[
^aaaaa |
- {1:b}bbbb |
- {1:c}cccc |
- {1:d}dddd |
- {2:~ }|*3
+ {21:b}bbbb |
+ {21:c}cccc |
+ {21:d}dddd |
+ {1:~ }|*3
|
]],
})
@@ -1466,34 +1351,34 @@ describe('CursorColumn highlight', function()
insert('line 1\nline 2\nline 3')
feed('k')
screen:expect([[
- line {4:1} |
- {5:line ^2 }|
- line {4:3} |
- {2:~ }|*4
+ line {30:1} |
+ {100:line ^2 }|
+ line {30:3} |
+ {1:~ }|*4
|
]])
feed('l')
screen:expect([[
- line 1{4: } |
- {5:line 2^ }|
- line 3{4: } |
- {2:~ }|*4
+ line 1{30: } |
+ {100:line 2^ }|
+ line 3{30: } |
+ {1:~ }|*4
|
]])
feed('l')
screen:expect([[
- line 1 {4: } |
- {5:line 2 ^ }|
- line 3 {4: } |
- {2:~ }|*4
+ line 1 {30: } |
+ {100:line 2 ^ }|
+ line 3 {30: } |
+ {1:~ }|*4
|
]])
feed('l')
screen:expect([[
- line 1 {4: } |
- {5:line 2 ^ }|
- line 3 {4: } |
- {2:~ }|*4
+ line 1 {30: } |
+ {100:line 2 ^ }|
+ line 3 {30: } |
+ {1:~ }|*4
|
]])
end)
@@ -1505,17 +1390,11 @@ describe('ColorColumn highlight', function()
before_each(function()
clear()
screen = Screen.new(40, 15)
- screen:set_default_attr_ids({
- [1] = { background = Screen.colors.LightRed }, -- ColorColumn
- [2] = { background = Screen.colors.Grey90 }, -- CursorLine
- [3] = { foreground = Screen.colors.Brown }, -- LineNr
- [4] = { foreground = Screen.colors.Brown, bold = true }, -- CursorLineNr
- [5] = { foreground = Screen.colors.Blue, bold = true }, -- NonText
- [6] = { foreground = Screen.colors.Blue, background = Screen.colors.LightRed, bold = true },
- [7] = { reverse = true, bold = true }, -- StatusLine
- [8] = { reverse = true }, -- StatusLineNC
- [9] = { background = Screen.colors.Grey90, foreground = Screen.colors.Red },
- })
+ 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 },
+ }
screen:attach()
end)
@@ -1533,16 +1412,16 @@ describe('ColorColumn highlight', function()
buf X
]])
screen:expect([[
- {4: 1 }11{1:1}11111{1:1}1 |
- {3: 2 }22{1:2}22222{1:2}22 |
- {3: 3 }33{1:3}33333{1:3}3 |
- {5:~ }|*3
- {8:X }|
- {4: 1 }^11{1:1}11111{1:1}1 |
- {3: 2 }22{1:2}22222{1:2}22 |
- {3: 3 }33{1:3}33333{1:3}3 |
- {5:~ }|*3
- {7: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
+ {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 }|
|
]])
end)
@@ -1554,9 +1433,9 @@ describe('ColorColumn highlight', function()
set co=40 linebreak bri briopt=shift:2 cc=40,41,43
]])
screen:expect([[
- ^The quick brown fox jumped over the {1: }|
- {1: } {1:l}azy dogs |
- {5:~ }|*12
+ ^The quick brown fox jumped over the {101: }|
+ {101: } {101:l}azy dogs |
+ {1:~ }|*12
|
]])
end)
@@ -1568,9 +1447,9 @@ describe('ColorColumn highlight', function()
set co=40 showbreak=+++>\\ cc=40,41,43
]])
screen:expect([[
- ^The quick brown fox jumped over the laz{1:y}|
- {6:+}{5:+}{6:+}{5:>\} dogs |
- {5:~ }|*12
+ ^The quick brown fox jumped over the laz{101:y}|
+ {102:+}{1:+}{102:+}{1:>\} dogs |
+ {1:~ }|*12
|
]])
end)
@@ -1579,17 +1458,17 @@ describe('ColorColumn highlight', function()
screen:try_resize(40, 2)
command('set colorcolumn=30 cursorline')
screen:expect([[
- {2:^ }{1: }{2: }|
+ {21:^ }{101: }{21: }|
|
]])
command('hi clear ColorColumn')
screen:expect([[
- {2:^ }|
+ {21:^ }|
|
]])
command('hi ColorColumn guifg=Red')
screen:expect([[
- {2:^ }{9: }{2: }|
+ {21:^ }{100: }{21: }|
|
]])
end)