diff options
author | Ibby <33922797+SleepySwords@users.noreply.github.com> | 2023-03-19 16:31:08 +1100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-05-22 13:49:42 +0200 |
commit | efa9b299a7cb68909e9bcd290e4d12bcb6d0bb03 (patch) | |
tree | 925b19777f7592fe58219124accf66da5c72c981 /test | |
parent | b11a8c1b5d3985479351b34f2078d490cbf59e90 (diff) | |
download | rneovim-efa9b299a7cb68909e9bcd290e4d12bcb6d0bb03.tar.gz rneovim-efa9b299a7cb68909e9bcd290e4d12bcb6d0bb03.tar.bz2 rneovim-efa9b299a7cb68909e9bcd290e4d12bcb6d0bb03.zip |
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.
https://github.com/vim/vim/commit/7f9969c559b51446632ac7e8f76cde07e7d0078d
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.
https://github.com/vim/vim/commit/711483cd1381a4ed848d783ae0a6792d5b04447b
Co-authored-by: bfredl <bjorn.linse@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index ccf1810ee1..80dfebd33e 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -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() |