mirror of
https://github.com/neovim/neovim.git
synced 2026-02-10 06:21:49 +10:00
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.7f9969c559vim-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.711483cd13Co-authored-by: bfredl <bjorn.linse@gmail.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user