mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(test): clean up inline virtual text tests a little
This commit is contained in:
parent
a78fd18ed9
commit
c5528e7fd8
@ -611,6 +611,20 @@ describe('decorations providers', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local example_text = [[
|
||||||
|
for _,item in ipairs(items) do
|
||||||
|
local text, hl_id_cell, count = unpack(item)
|
||||||
|
if hl_id_cell ~= nil then
|
||||||
|
hl_id = hl_id_cell
|
||||||
|
end
|
||||||
|
for _ = 1, (count or 1) do
|
||||||
|
local cell = line[colpos]
|
||||||
|
cell.text = text
|
||||||
|
cell.hl_id = hl_id
|
||||||
|
colpos = colpos+1
|
||||||
|
end
|
||||||
|
end]]
|
||||||
|
|
||||||
describe('extmark decorations', function()
|
describe('extmark decorations', function()
|
||||||
local screen, ns
|
local screen, ns
|
||||||
before_each( function()
|
before_each( function()
|
||||||
@ -645,31 +659,11 @@ describe('extmark decorations', function()
|
|||||||
[25] = {background = Screen.colors.LightRed};
|
[25] = {background = Screen.colors.LightRed};
|
||||||
[26] = {background=Screen.colors.DarkGrey, foreground=Screen.colors.LightGrey};
|
[26] = {background=Screen.colors.DarkGrey, foreground=Screen.colors.LightGrey};
|
||||||
[27] = {background = Screen.colors.Plum1};
|
[27] = {background = Screen.colors.Plum1};
|
||||||
[28] = {foreground = Screen.colors.SlateBlue};
|
|
||||||
[29] = {background = Screen.colors.Yellow1};
|
|
||||||
[30] = {reverse = true};
|
|
||||||
[31] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.LightMagenta};
|
|
||||||
[32] = {bold = true, reverse = true};
|
|
||||||
[33] = {background = Screen.colors.Red1, bold = true}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ns = meths.create_namespace 'test'
|
ns = meths.create_namespace 'test'
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local example_text = [[
|
|
||||||
for _,item in ipairs(items) do
|
|
||||||
local text, hl_id_cell, count = unpack(item)
|
|
||||||
if hl_id_cell ~= nil then
|
|
||||||
hl_id = hl_id_cell
|
|
||||||
end
|
|
||||||
for _ = 1, (count or 1) do
|
|
||||||
local cell = line[colpos]
|
|
||||||
cell.text = text
|
|
||||||
cell.hl_id = hl_id
|
|
||||||
colpos = colpos+1
|
|
||||||
end
|
|
||||||
end]]
|
|
||||||
|
|
||||||
it('empty virtual text at eol should not break colorcolumn #17860', function()
|
it('empty virtual text at eol should not break colorcolumn #17860', function()
|
||||||
insert(example_text)
|
insert(example_text)
|
||||||
feed('gg')
|
feed('gg')
|
||||||
@ -1171,8 +1165,38 @@ end]]
|
|||||||
meths.buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestBold', priority = 20 })
|
meths.buf_set_extmark(0, ns, 0, 3, { end_col = 6, hl_group = 'TestBold', priority = 20 })
|
||||||
screen:expect_unchanged(true)
|
screen:expect_unchanged(true)
|
||||||
end)
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
it('can have virtual text of inline position', function()
|
|
||||||
|
describe('decorations: inline virtual text', function()
|
||||||
|
local screen, ns
|
||||||
|
before_each( function()
|
||||||
|
clear()
|
||||||
|
screen = Screen.new(50, 10)
|
||||||
|
screen:attach()
|
||||||
|
screen:set_default_attr_ids {
|
||||||
|
[1] = {bold=true, foreground=Screen.colors.Blue};
|
||||||
|
[2] = {foreground = Screen.colors.Brown};
|
||||||
|
[3] = {bold = true, foreground = Screen.colors.SeaGreen};
|
||||||
|
[4] = {background = Screen.colors.Red1, foreground = Screen.colors.Gray100};
|
||||||
|
[5] = {background = Screen.colors.Red1, bold = true};
|
||||||
|
[6] = {foreground = Screen.colors.DarkCyan};
|
||||||
|
[7] = {background = Screen.colors.LightGrey};
|
||||||
|
[8] = {bold = true};
|
||||||
|
[9] = {background = Screen.colors.Plum1};
|
||||||
|
[10] = {foreground = Screen.colors.SlateBlue};
|
||||||
|
[11] = {blend = 30, background = Screen.colors.Red1};
|
||||||
|
[12] = {background = Screen.colors.Yellow1};
|
||||||
|
[13] = {reverse = true};
|
||||||
|
[14] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.LightMagenta};
|
||||||
|
[15] = {bold = true, reverse = true};
|
||||||
|
}
|
||||||
|
|
||||||
|
ns = meths.create_namespace 'test'
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
it('works', function()
|
||||||
insert(example_text)
|
insert(example_text)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
@ -1185,18 +1209,13 @@ end]]
|
|||||||
local cell = line[colpos] |
|
local cell = line[colpos] |
|
||||||
cell.text = text |
|
cell.text = text |
|
||||||
cell.hl_id = hl_id |
|
cell.hl_id = hl_id |
|
||||||
colpos = colpos+1 |
|
|
||||||
end |
|
|
||||||
end |
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'})
|
meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'})
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
^for _,item in ipairs(items) do |
|
^for _,item in ipairs(items) do |
|
||||||
local text{28:: }{3:string}, hl_id_cell, count = unpack|
|
local text{10:: }{3:string}, hl_id_cell, count = unpack|
|
||||||
(item) |
|
(item) |
|
||||||
if hl_id_cell ~= nil then |
|
if hl_id_cell ~= nil then |
|
||||||
hl_id = hl_id_cell |
|
hl_id = hl_id_cell |
|
||||||
@ -1204,18 +1223,13 @@ end]]
|
|||||||
for _ = 1, (count or 1) do |
|
for _ = 1, (count or 1) do |
|
||||||
local cell = line[colpos] |
|
local cell = line[colpos] |
|
||||||
cell.text = text |
|
cell.text = text |
|
||||||
cell.hl_id = hl_id |
|
|
||||||
colpos = colpos+1 |
|
|
||||||
end |
|
|
||||||
end |
|
|
||||||
{1:~ }|
|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
|
|
||||||
screen:try_resize(55, 15)
|
screen:try_resize(55, 10)
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
^for _,item in ipairs(items) do |
|
^for _,item in ipairs(items) do |
|
||||||
local text{28:: }{3:string}, hl_id_cell, count = unpack(item|
|
local text{10:: }{3:string}, hl_id_cell, count = unpack(item|
|
||||||
) |
|
) |
|
||||||
if hl_id_cell ~= nil then |
|
if hl_id_cell ~= nil then |
|
||||||
hl_id = hl_id_cell |
|
hl_id = hl_id_cell |
|
||||||
@ -1223,18 +1237,13 @@ end]]
|
|||||||
for _ = 1, (count or 1) do |
|
for _ = 1, (count or 1) do |
|
||||||
local cell = line[colpos] |
|
local cell = line[colpos] |
|
||||||
cell.text = text |
|
cell.text = text |
|
||||||
cell.hl_id = hl_id |
|
|
||||||
colpos = colpos+1 |
|
|
||||||
end |
|
|
||||||
end |
|
|
||||||
{1:~ }|
|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
|
|
||||||
screen:try_resize(56, 15)
|
screen:try_resize(56, 10)
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
^for _,item in ipairs(items) do |
|
^for _,item in ipairs(items) do |
|
||||||
local text{28:: }{3:string}, hl_id_cell, count = unpack(item)|
|
local text{10:: }{3:string}, hl_id_cell, count = unpack(item)|
|
||||||
if hl_id_cell ~= nil then |
|
if hl_id_cell ~= nil then |
|
||||||
hl_id = hl_id_cell |
|
hl_id = hl_id_cell |
|
||||||
end |
|
end |
|
||||||
@ -1242,11 +1251,6 @@ end]]
|
|||||||
local cell = line[colpos] |
|
local cell = line[colpos] |
|
||||||
cell.text = text |
|
cell.text = text |
|
||||||
cell.hl_id = hl_id |
|
cell.hl_id = hl_id |
|
||||||
colpos = colpos+1 |
|
|
||||||
end |
|
|
||||||
end |
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
@ -1260,12 +1264,7 @@ end]]
|
|||||||
feed '^'
|
feed '^'
|
||||||
feed '4l'
|
feed '4l'
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
1234{28: virtual text virtual text }^5678 |
|
1234{10: virtual text virtual text }^5678 |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1285,12 +1284,7 @@ end]]
|
|||||||
{ virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { ' virtual text ', 'Special' } }, virt_text_pos = 'inline' })
|
||||||
|
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
1234{28: virtual text }567^8 |
|
1234{10: virtual text }567^8 |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1303,18 +1297,13 @@ end]]
|
|||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('has correct highlighting with multi-byte characters in inline virtual text', function()
|
it('has correct highlighting with multi-byte characters', function()
|
||||||
insert('12345678')
|
insert('12345678')
|
||||||
meths.buf_set_extmark(0, ns, 0, 4,
|
meths.buf_set_extmark(0, ns, 0, 4,
|
||||||
{ virt_text = { { 'múlti-byté chñröcters 修补', 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { 'múlti-byté chñröcters 修补', 'Special' } }, virt_text_pos = 'inline' })
|
||||||
|
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
1234{28:múlti-byté chñröcters 修补}567^8 |
|
1234{10:múlti-byté chñröcters 修补}567^8 |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1335,7 +1324,7 @@ end]]
|
|||||||
feed '3l'
|
feed '3l'
|
||||||
feed 'a'
|
feed 'a'
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
1234{28:^virtual text}5678 |
|
1234{10:^virtual text}5678 |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1344,19 +1333,26 @@ end]]
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{8:-- INSERT --} |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{24:-- INSERT --} |
|
|
||||||
]]}
|
]]}
|
||||||
feed '<ESC>'
|
feed '<ESC>'
|
||||||
|
screen:expect{grid=[[
|
||||||
|
123^4{10:virtual text}5678 |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
feed '^'
|
feed '^'
|
||||||
feed '4l'
|
feed '4l'
|
||||||
feed 'i'
|
feed 'i'
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
1234{28:^virtual text}5678 |
|
1234{10:^virtual text}5678 |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1365,12 +1361,7 @@ end]]
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{8:-- INSERT --} |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{24:-- INSERT --} |
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -1378,12 +1369,7 @@ end]]
|
|||||||
meths.buf_set_extmark(0, ns, 0, 0,
|
meths.buf_set_extmark(0, ns, 0, 0,
|
||||||
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:^virtual text} |
|
{10:^virtual text} |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1407,82 +1393,62 @@ bbbbbbb]])
|
|||||||
{ virt_text = { { string.rep('X', 50), 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { string.rep('X', 50), 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('gg0')
|
feed('gg0')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{10:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
{28:X} |
|
{10:X} |
|
||||||
aaaaaaa |
|
aaaaaaa |
|
||||||
{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
bbbbbbb |
|
bbbbbbb |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
|
|
||||||
feed('j')
|
feed('j')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
{28:X} |
|
{10:X} |
|
||||||
^aaaaaaa |
|
^aaaaaaa |
|
||||||
{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
bbbbbbb |
|
bbbbbbb |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
|
|
||||||
feed('j')
|
feed('j')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
{28:X} |
|
{10:X} |
|
||||||
aaaaaaa |
|
aaaaaaa |
|
||||||
{28:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{10:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
bbbbbbb |
|
bbbbbbb |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
|
|
||||||
feed('j')
|
feed('j')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
{28:X} |
|
{10:X} |
|
||||||
aaaaaaa |
|
aaaaaaa |
|
||||||
{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
^bbbbbbb |
|
^bbbbbbb |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('cursor position is correct with virtual text attatched to hard tabs', function()
|
it('cursor position is correct with virtual text attached to hard tabs', function()
|
||||||
command('set noexpandtab')
|
command('set noexpandtab')
|
||||||
feed('i')
|
feed('i')
|
||||||
feed('<TAB>')
|
feed('<TAB>')
|
||||||
@ -1493,12 +1459,7 @@ bbbbbbb]])
|
|||||||
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('0')
|
feed('0')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
^ {28:virtual text} test |
|
^ {10:virtual text} test |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1512,12 +1473,7 @@ bbbbbbb]])
|
|||||||
|
|
||||||
feed('l')
|
feed('l')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:virtual text} ^ test |
|
{10:virtual text} ^ test |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1531,12 +1487,7 @@ bbbbbbb]])
|
|||||||
|
|
||||||
feed('l')
|
feed('l')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:virtual text} ^test |
|
{10:virtual text} ^test |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1550,12 +1501,7 @@ bbbbbbb]])
|
|||||||
|
|
||||||
feed('l')
|
feed('l')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:virtual text} t^est |
|
{10:virtual text} t^est |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1569,12 +1515,7 @@ bbbbbbb]])
|
|||||||
|
|
||||||
feed('l')
|
feed('l')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:virtual text} te^st |
|
{10:virtual text} te^st |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1594,12 +1535,7 @@ bbbbbbb]])
|
|||||||
meths.buf_set_extmark(0, ns, 0, 3,
|
meths.buf_set_extmark(0, ns, 0, 3,
|
||||||
{ virt_text = { { ': virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { ': virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
^one{28:: virtual text} twoword |
|
^one{10:: virtual text} twoword |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1612,18 +1548,13 @@ bbbbbbb]])
|
|||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('search highlight is correct with virtual text attatched to', function()
|
it('search highlight is correct', function()
|
||||||
insert('foo foo foo foo')
|
insert('foo foo foo foo')
|
||||||
feed('0')
|
feed('0')
|
||||||
meths.buf_set_extmark(0, ns, 0, 8,
|
meths.buf_set_extmark(0, ns, 0, 8,
|
||||||
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
^foo foo {28:virtual text}foo foo |
|
^foo foo {10:virtual text}foo foo |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1637,12 +1568,7 @@ bbbbbbb]])
|
|||||||
|
|
||||||
feed('/foo')
|
feed('/foo')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{29:foo} {30:foo} {28:virtual text}{29:foo} {29:foo} |
|
{12:foo} {13:foo} {10:virtual text}{12:foo} {12:foo} |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1655,20 +1581,14 @@ bbbbbbb]])
|
|||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
feed('8l')
|
it('visual select highlight is correct', function()
|
||||||
it('visual select highlight is correct with virtual text attatched to', function()
|
|
||||||
insert('foo foo foo foo')
|
insert('foo foo foo foo')
|
||||||
feed('0')
|
feed('0')
|
||||||
meths.buf_set_extmark(0, ns, 0, 8,
|
meths.buf_set_extmark(0, ns, 0, 8,
|
||||||
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('8l')
|
feed('8l')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
foo foo {28:virtual text}^foo foo |
|
foo foo {10:virtual text}^foo foo |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1683,7 +1603,7 @@ bbbbbbb]])
|
|||||||
feed('v')
|
feed('v')
|
||||||
feed('2h')
|
feed('2h')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
foo fo^o{18: }{28:virtual text}{18:f}oo foo |
|
foo fo^o{7: }{10:virtual text}{7:f}oo foo |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1692,12 +1612,7 @@ bbbbbbb]])
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{8:-- VISUAL --} |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{24:-- VISUAL --} |
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -1708,12 +1623,7 @@ bbbbbbb]])
|
|||||||
feed('0')
|
feed('0')
|
||||||
feed('8l')
|
feed('8l')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
foo foo {28:virtual text}^foo foo |
|
foo foo {10:virtual text}^foo foo |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1727,7 +1637,7 @@ bbbbbbb]])
|
|||||||
|
|
||||||
feed('i')
|
feed('i')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
foo foo {28:virtual text}^foo foo |
|
foo foo {10:virtual text}^foo foo |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1736,12 +1646,7 @@ bbbbbbb]])
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{8:-- INSERT --} |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{24:-- INSERT --} |
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -1751,12 +1656,7 @@ bbbbbbb]])
|
|||||||
meths.buf_set_extmark(0, ns, 0, 8, { virt_text = {{ '<<', 'Special' }}, virt_text_pos = 'inline', right_gravity = true })
|
meths.buf_set_extmark(0, ns, 0, 8, { virt_text = {{ '<<', 'Special' }}, virt_text_pos = 'inline', right_gravity = true })
|
||||||
feed('08l')
|
feed('08l')
|
||||||
screen:expect{ grid = [[
|
screen:expect{ grid = [[
|
||||||
foo foo {28:>><<}^foo foo |
|
foo foo {10:>><<}^foo foo |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1770,7 +1670,7 @@ bbbbbbb]])
|
|||||||
|
|
||||||
feed('i')
|
feed('i')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
foo foo {28:>>^<<}foo foo |
|
foo foo {10:>>^<<}foo foo |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1779,12 +1679,7 @@ bbbbbbb]])
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{8:-- INSERT --} |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{24:-- INSERT --} |
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -1797,12 +1692,7 @@ bbbbbbb]])
|
|||||||
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('$')
|
feed('$')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
opqrstuvwxyzabcdefghijklmnopqrstuvwx{28:virtual text}y^z|
|
opqrstuvwxyzabcdefghijklmnopqrstuvwx{10:virtual text}y^z|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1822,12 +1712,7 @@ bbbbbbb]])
|
|||||||
{ virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('$')
|
feed('$')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}cdefgh^i|
|
{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}cdefgh^i|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1847,12 +1732,7 @@ bbbbbbb]])
|
|||||||
{ virt_text = { { string.rep('a', 55), 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { string.rep('a', 55), 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('gg$')
|
feed('gg$')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:aaaaaaaaaaaaaaaaaaaaaaaaa}test ^a |
|
{10:aaaaaaaaaaaaaaaaaaaaaaaaa}test ^a |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1872,12 +1752,7 @@ bbbbbbb]])
|
|||||||
{ virt_text = { { string.rep('X', 50), 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { string.rep('X', 50), 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('$')
|
feed('$')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}de^f|
|
{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}de^f|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1899,19 +1774,14 @@ bbbbbbb]])
|
|||||||
{ virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('gg0')
|
feed('gg0')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{2: 1 }^t{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
{2: 1 }^t{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
|
||||||
{2: }{28:XXXXXXXXXX}est |
|
{2: }{10:XXXXXXXXXX}est |
|
||||||
{2: 2 }test |
|
{2: 2 }test |
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
@ -1924,12 +1794,7 @@ bbbbbbb]])
|
|||||||
feed('gg0')
|
feed('gg0')
|
||||||
command('match ErrorMsg /e/')
|
command('match ErrorMsg /e/')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
^t{4:e}{28:virtual text}st |
|
^t{4:e}{10:virtual text}st |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1942,12 +1807,7 @@ bbbbbbb]])
|
|||||||
]]}
|
]]}
|
||||||
command('match ErrorMsg /s/')
|
command('match ErrorMsg /s/')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
^te{28:virtual text}{4:s}t |
|
^te{10:virtual text}{4:s}t |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1960,7 +1820,7 @@ bbbbbbb]])
|
|||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('in diff mode virtual text is highlighted correct', function()
|
it('in diff mode is highlighted correct', function()
|
||||||
insert([[
|
insert([[
|
||||||
9000
|
9000
|
||||||
0009
|
0009
|
||||||
@ -1982,20 +1842,15 @@ bbbbbbb]])
|
|||||||
command("set diff")
|
command("set diff")
|
||||||
feed('gg0')
|
feed('gg0')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{27:^000 }│{33:9}{31:test}{27:000 }|
|
{9:^000 }│{5:9}{14:test}{9:000 }|
|
||||||
{27:000 }│{27:000}{33:9}{27: }|
|
{9:000 }│{9:000}{5:9}{9: }|
|
||||||
{27:000 }│{27:000}{33:9}{27: }|
|
{9:000 }│{9:000}{5:9}{9: }|
|
||||||
{27:000 }│{33:9}{27:000 }|
|
{9:000 }│{5:9}{9:000 }|
|
||||||
{27:000 }│{27:000}{33:9}{27: }|
|
{9:000 }│{9:000}{5:9}{9: }|
|
||||||
│ |
|
│ |
|
||||||
{1:~ }│{1:~ }|
|
{1:~ }│{1:~ }|
|
||||||
{1:~ }│{1:~ }|
|
{1:~ }│{1:~ }|
|
||||||
{1:~ }│{1:~ }|
|
{15:[No Name] [+] }{13:[No Name] [+] }|
|
||||||
{1:~ }│{1:~ }|
|
|
||||||
{1:~ }│{1:~ }|
|
|
||||||
{1:~ }│{1:~ }|
|
|
||||||
{1:~ }│{1:~ }|
|
|
||||||
{32:[No Name] [+] }{30:[No Name] [+] }|
|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
@ -2009,12 +1864,7 @@ bbbbbbb]])
|
|||||||
{ virt_text = { { string.rep('b', 55), 'Special' } }, virt_text_pos = 'inline' })
|
{ virt_text = { { string.rep('b', 55), 'Special' } }, virt_text_pos = 'inline' })
|
||||||
feed('$')
|
feed('$')
|
||||||
screen:expect { grid = [[
|
screen:expect { grid = [[
|
||||||
{28:bbbbbbbbbbbbbbbbbbbbbbbbb}^a |
|
{10:bbbbbbbbbbbbbbbbbbbbbbbbb}^a |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -2040,12 +1890,7 @@ bbbbbbb]])
|
|||||||
feed('0')
|
feed('0')
|
||||||
screen:expect({
|
screen:expect({
|
||||||
grid = [[
|
grid = [[
|
||||||
{28:aaaaaaaaaaaaaaaaaaaaaa} ^ test |
|
{10:aaaaaaaaaaaaaaaaaaaaaa} ^ test |
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -2081,7 +1926,7 @@ describe('decorations: virtual lines', function()
|
|||||||
ns = meths.create_namespace 'test'
|
ns = meths.create_namespace 'test'
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local example_text = [[
|
local example_text2 = [[
|
||||||
if (h->n_buckets < new_n_buckets) { // expand
|
if (h->n_buckets < new_n_buckets) { // expand
|
||||||
khkey_t *new_keys = (khkey_t *)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t));
|
khkey_t *new_keys = (khkey_t *)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t));
|
||||||
h->keys = new_keys;
|
h->keys = new_keys;
|
||||||
@ -2092,7 +1937,7 @@ if (h->n_buckets < new_n_buckets) { // expand
|
|||||||
}]]
|
}]]
|
||||||
|
|
||||||
it('works with one line', function()
|
it('works with one line', function()
|
||||||
insert(example_text)
|
insert(example_text2)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
meths.buf_set_extmark(0, ns, 1, 33, {
|
meths.buf_set_extmark(0, ns, 1, 33, {
|
||||||
virt_lines={ {{">> ", "NonText"}, {"krealloc", "Identifier"}, {": change the size of an allocation"}}};
|
virt_lines={ {{">> ", "NonText"}, {"krealloc", "Identifier"}, {": change the size of an allocation"}}};
|
||||||
@ -2201,7 +2046,7 @@ if (h->n_buckets < new_n_buckets) { // expand
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with text at the beginning of the buffer', function()
|
it('works with text at the beginning of the buffer', function()
|
||||||
insert(example_text)
|
insert(example_text2)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
@ -2262,7 +2107,7 @@ if (h->n_buckets < new_n_buckets) { // expand
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with text at the end of the buffer', function()
|
it('works with text at the end of the buffer', function()
|
||||||
insert(example_text)
|
insert(example_text2)
|
||||||
feed 'G'
|
feed 'G'
|
||||||
|
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
@ -2381,7 +2226,7 @@ if (h->n_buckets < new_n_buckets) { // expand
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works beyond end of the buffer with virt_lines_above', function()
|
it('works beyond end of the buffer with virt_lines_above', function()
|
||||||
insert(example_text)
|
insert(example_text2)
|
||||||
feed 'G'
|
feed 'G'
|
||||||
|
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
@ -2652,7 +2497,7 @@ if (h->n_buckets < new_n_buckets) { // expand
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with sign and numbercolumns', function()
|
it('works with sign and numbercolumns', function()
|
||||||
insert(example_text)
|
insert(example_text2)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
command 'set number signcolumn=yes'
|
command 'set number signcolumn=yes'
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
@ -2718,7 +2563,7 @@ if (h->n_buckets < new_n_buckets) { // expand
|
|||||||
|
|
||||||
|
|
||||||
it('works with hard tabs', function()
|
it('works with hard tabs', function()
|
||||||
insert(example_text)
|
insert(example_text2)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
meths.buf_set_extmark(0, ns, 1, 0, {
|
meths.buf_set_extmark(0, ns, 1, 0, {
|
||||||
virt_lines={ {{">>", "NonText"}, {"\tvery\ttabby", "Identifier"}, {"text\twith\ttabs"}}};
|
virt_lines={ {{">>", "NonText"}, {"\tvery\ttabby", "Identifier"}, {"text\twith\ttabs"}}};
|
||||||
@ -2805,7 +2650,7 @@ describe('decorations: signs', function()
|
|||||||
meths.set_option_value('signcolumn', 'auto:9', {})
|
meths.set_option_value('signcolumn', 'auto:9', {})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local example_text = [[
|
local example_test3 = [[
|
||||||
l1
|
l1
|
||||||
l2
|
l2
|
||||||
l3
|
l3
|
||||||
@ -2814,7 +2659,7 @@ l5
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
it('can add a single sign (no end row)', function()
|
it('can add a single sign (no end row)', function()
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S'})
|
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S'})
|
||||||
@ -2835,7 +2680,7 @@ l5
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can add a single sign (with end row)', function()
|
it('can add a single sign (with end row)', function()
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row=1})
|
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row=1})
|
||||||
@ -2857,7 +2702,7 @@ l5
|
|||||||
|
|
||||||
it('can add multiple signs (single extmark)', function()
|
it('can add multiple signs (single extmark)', function()
|
||||||
pending('TODO(lewis6991): Support ranged signs')
|
pending('TODO(lewis6991): Support ranged signs')
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row = 2})
|
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S', end_row = 2})
|
||||||
@ -2879,7 +2724,7 @@ l5
|
|||||||
|
|
||||||
it('can add multiple signs (multiple extmarks)', function()
|
it('can add multiple signs (multiple extmarks)', function()
|
||||||
pending('TODO(lewis6991): Support ranged signs')
|
pending('TODO(lewis6991): Support ranged signs')
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed'gg'
|
feed'gg'
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S1'})
|
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S1'})
|
||||||
@ -2901,7 +2746,7 @@ l5
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can add multiple signs (multiple extmarks) 2', function()
|
it('can add multiple signs (multiple extmarks) 2', function()
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S1'})
|
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S1'})
|
||||||
@ -2941,7 +2786,7 @@ l5
|
|||||||
it('can add multiple signs (multiple extmarks) 3', function()
|
it('can add multiple signs (multiple extmarks) 3', function()
|
||||||
pending('TODO(lewis6991): Support ranged signs')
|
pending('TODO(lewis6991): Support ranged signs')
|
||||||
|
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S1', end_row=2})
|
meths.buf_set_extmark(0, ns, 1, -1, {sign_text='S1', end_row=2})
|
||||||
@ -2962,7 +2807,7 @@ l5
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can add multiple signs (multiple extmarks) 4', function()
|
it('can add multiple signs (multiple extmarks) 4', function()
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=0})
|
meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', end_row=0})
|
||||||
@ -2983,7 +2828,7 @@ l5
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with old signs', function()
|
it('works with old signs', function()
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
helpers.command('sign define Oldsign text=x')
|
helpers.command('sign define Oldsign text=x')
|
||||||
@ -3010,7 +2855,7 @@ l5
|
|||||||
|
|
||||||
it('works with old signs (with range)', function()
|
it('works with old signs (with range)', function()
|
||||||
pending('TODO(lewis6991): Support ranged signs')
|
pending('TODO(lewis6991): Support ranged signs')
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
helpers.command('sign define Oldsign text=x')
|
helpers.command('sign define Oldsign text=x')
|
||||||
@ -3039,7 +2884,7 @@ l5
|
|||||||
it('can add a ranged sign (with start out of view)', function()
|
it('can add a ranged sign (with start out of view)', function()
|
||||||
pending('TODO(lewis6991): Support ranged signs')
|
pending('TODO(lewis6991): Support ranged signs')
|
||||||
|
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
command 'set signcolumn=yes:2'
|
command 'set signcolumn=yes:2'
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
feed '2<C-e>'
|
feed '2<C-e>'
|
||||||
@ -3096,7 +2941,7 @@ l5
|
|||||||
|
|
||||||
it('works with priority #19716', function()
|
it('works with priority #19716', function()
|
||||||
screen:try_resize(20, 3)
|
screen:try_resize(20, 3)
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
helpers.command('sign define Oldsign text=O3')
|
helpers.command('sign define Oldsign text=O3')
|
||||||
@ -3126,7 +2971,7 @@ l5
|
|||||||
it('does not set signcolumn for signs without text', function()
|
it('does not set signcolumn for signs without text', function()
|
||||||
screen:try_resize(20, 3)
|
screen:try_resize(20, 3)
|
||||||
meths.set_option_value('signcolumn', 'auto', {})
|
meths.set_option_value('signcolumn', 'auto', {})
|
||||||
insert(example_text)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
meths.buf_set_extmark(0, ns, 0, -1, {number_hl_group='Error'})
|
meths.buf_set_extmark(0, ns, 0, -1, {number_hl_group='Error'})
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
|
Loading…
Reference in New Issue
Block a user