aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-28 20:20:25 +0800
committerGitHub <noreply@github.com>2023-09-28 20:20:25 +0800
commit28ffd96c9b3912b65bbe0ad0fe8fb123407a6d1e (patch)
tree9423ac60cd8a534dbe0326a362b604bba244a72b
parent19130415183763a572c50c8ae343dff8cc20526e (diff)
downloadrneovim-28ffd96c9b3912b65bbe0ad0fe8fb123407a6d1e.tar.gz
rneovim-28ffd96c9b3912b65bbe0ad0fe8fb123407a6d1e.tar.bz2
rneovim-28ffd96c9b3912b65bbe0ad0fe8fb123407a6d1e.zip
test: decoration provider with wrapped lines (#25404)
-rw-r--r--test/functional/ui/decorations_spec.lua66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index f535bdd1a6..2c4bcadc4b 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -521,6 +521,72 @@ describe('decorations providers', function()
]]}
end)
+ it('virtual text works with wrapped lines', function()
+ insert(mulholland)
+ feed('ggJj3JjJ')
+ setup_provider [[
+ local hl = api.nvim_get_hl_id_by_name "ErrorMsg"
+ local test_ns = api.nvim_create_namespace "mulholland"
+ function on_do(event, ...)
+ if event == "line" then
+ local win, buf, line = ...
+ api.nvim_buf_set_extmark(buf, test_ns, line, 0, {
+ virt_text = {{string.rep('/', line+1), 'ErrorMsg'}};
+ virt_text_pos='eol';
+ ephemeral = true;
+ })
+ api.nvim_buf_set_extmark(buf, test_ns, line, 6, {
+ virt_text = {{string.rep('*', line+1), 'ErrorMsg'}};
+ virt_text_pos='overlay';
+ ephemeral = true;
+ })
+ api.nvim_buf_set_extmark(buf, test_ns, line, 39, {
+ virt_text = {{string.rep('!', line+1), 'ErrorMsg'}};
+ virt_text_win_col=20;
+ ephemeral = true;
+ })
+ api.nvim_buf_set_extmark(buf, test_ns, line, 40, {
+ virt_text = {{string.rep('?', line+1), 'ErrorMsg'}};
+ virt_text_win_col=10;
+ ephemeral = true;
+ })
+ api.nvim_buf_set_extmark(buf, test_ns, line, 40, {
+ virt_text = {{string.rep(';', line+1), 'ErrorMsg'}};
+ virt_text_pos='overlay';
+ ephemeral = true;
+ })
+ api.nvim_buf_set_extmark(buf, test_ns, line, 40, {
+ virt_text = {{'+'}, {string.rep(' ', line+1), 'ErrorMsg'}};
+ virt_text_pos='right_align';
+ ephemeral = true;
+ })
+ end
+ end
+ ]]
+
+ screen:expect{grid=[[
+ // jus{2:*} to see if th{2:!}re was an accident |
+ {2:;}n Mulholl{2:?}nd Drive {2:/} +{2: }|
+ try_st{2:**}t(); bufref_{2:!!}save_buf; switch_b|
+ {2:;;}fer(&sav{2:??}buf, buf); {2://} +{2: }|
+ posp ={2:***}tmark(mark,{2:!!!}lse);^ restore_buf|
+ {2:;;;}(&save_{2:???}); {2:///} +{2: }|
+ {1:~ }|
+ |
+ ]]}
+ command('setlocal breakindent breakindentopt=shift:2')
+ screen:expect{grid=[[
+ // jus{2:*} to see if th{2:!}re was an accident |
+ {2:;}n Mulho{2:?}land Drive {2:/} +{2: }|
+ try_st{2:**}t(); bufref_{2:!!}save_buf; switch_b|
+ {2:;;}fer(&s{2:??}e_buf, buf); {2://} +{2: }|
+ posp ={2:***}tmark(mark,{2:!!!}lse);^ restore_buf|
+ {2:;;;}(&sav{2:???}uf); {2:///} +{2: }|
+ {1:~ }|
+ |
+ ]]}
+ end)
+
it('can highlight beyond EOL', function()
insert(mulholland)
setup_provider [[