diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index c2030b9527..7969dd5d3b 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -509,6 +509,69 @@ describe('decorations providers', function() ]]} end) + it('can have virtual text of the style: eol_right_align', function() + insert(mulholland) + 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 = {{'+'}, {'1234567890', 'ErrorMsg'}}; + virt_text_pos='eol_right_align'; + ephemeral = true; + }) + end + end + ]] + + screen:expect{grid=[[ + // just to see if there was an accident | + // on Mulholland Drive +{2:1234567890}| + try_start(); +{2:1234567890}| + bufref_T save_buf; +{2:1234567890}| + switch_buffer(&save_buf, buf); +{2:12345678}| + posp = getmark(mark, false); +{2:1234567890}| + restore_buffer(&save_buf);^ +{2:1234567890}| + | + ]]} + end) + + it('multiple eol_right_align', function() + insert(mulholland) + 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 = {{'11111'}}; + virt_text_pos='eol_right_align'; + ephemeral = true; + }) + api.nvim_buf_set_extmark(0, test_ns, line, 0, { + virt_text = {{'22222'}}; + virt_text_pos='eol_right_align'; + ephemeral = true; + }) + end + end + ]] + + screen:expect{grid=[[ + // just to see if there was an accident | + // on Mulholland Drive 11111 22222| + try_start(); 11111 22222| + bufref_T save_buf; 11111 22222| + switch_buffer(&save_buf, buf); 11111 222| + posp = getmark(mark, false); 11111 22222| + restore_buffer(&save_buf);^ 11111 22222| + | + ]]} + end) + it('virtual text works with wrapped lines', function() insert(mulholland) feed('ggJj3JjJ') |