feat(ui): inline virtual text

vim-patch:9.0.0067: cannot show virtual text

Problem:    Cannot show virtual text.
Solution:   Initial changes for virtual text support, using text properties.

7f9969c559

vim-patch:9.0.0116: virtual text not displayed if 'signcolumn' is "yes"

Problem:    Virtual text not displayed if 'signcolumn' is "yes".
Solution:   Set c_extra and c_final to NUL.
711483cd13

Co-authored-by: bfredl <bjorn.linse@gmail.com>
This commit is contained in:
Ibby
2023-03-19 16:31:08 +11:00
committed by bfredl
parent b11a8c1b5d
commit efa9b299a7
6 changed files with 160 additions and 11 deletions

View File

@@ -645,6 +645,7 @@ describe('extmark decorations', function()
[25] = {background = Screen.colors.LightRed};
[26] = {background=Screen.colors.DarkGrey, foreground=Screen.colors.LightGrey};
[27] = {background = Screen.colors.Plum1};
[28] = {foreground = Screen.colors.SlateBlue};
}
ns = meths.create_namespace 'test'
@@ -1166,6 +1167,84 @@ end]]
screen:expect_unchanged(true)
end)
it('can have virtual text of inline position', function()
insert(example_text)
feed 'gg'
screen:expect{grid=[[
^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 |
{1:~ }|
{1:~ }|
|
]]}
meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'})
screen:expect{grid=[[
^for _,item in ipairs(items) do |
local text{28:: }{3:string}, 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 |
{1:~ }|
|
]]}
screen:try_resize(55, 15)
screen:expect{grid=[[
^for _,item in ipairs(items) do |
local text{28:: }{3:string}, 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 |
{1:~ }|
|
]]}
screen:try_resize(56, 15)
screen:expect{grid=[[
^for _,item in ipairs(items) do |
local text{28:: }{3:string}, 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 |
{1:~ }|
{1:~ }|
|
]]}
end)
end)
describe('decorations: virtual lines', function()