diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-02-20 21:47:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-20 21:47:12 +0800 |
commit | 51cf84daf9612574978731e66db45a52136b8899 (patch) | |
tree | 5ac6f72c40e5219356ac198e1c20ca4df55354cf /test/functional/ui | |
parent | 574ea6a1911b740bb611f0b658a83f606b6837bc (diff) | |
download | rneovim-51cf84daf9612574978731e66db45a52136b8899.tar.gz rneovim-51cf84daf9612574978731e66db45a52136b8899.tar.bz2 rneovim-51cf84daf9612574978731e66db45a52136b8899.zip |
feat(marks): virtual lines support horizontal scrolling (#32497)
Add a new field `virt_lines_overflow` that enables horizontal scrolling
for virtual lines when set to "scroll".
Diffstat (limited to 'test/functional/ui')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 135 |
1 files changed, 134 insertions, 1 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 2f83e7b97a..0f0aa3a5ed 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -4949,7 +4949,6 @@ if (h->n_buckets < new_n_buckets) { // expand ]]} end) - it('works with hard TABs', function() insert(example_text2) feed 'gg' @@ -5020,6 +5019,140 @@ if (h->n_buckets < new_n_buckets) { // expand ]]} end) + it('scrolls horizontally with virt_lines_overflow = "scroll" #31000', function() + command('set nowrap signcolumn=yes') + insert('abcdefghijklmnopqrstuvwxyz') + api.nvim_buf_set_extmark(0, ns, 0, 0, { + virt_lines = { + { { '12αβ̳γ̲口=', 'Special' }, { '❤️345678', 'Special' } }, + { { '123\t45\t678', 'NonText' } }, + }, + virt_lines_overflow = 'scroll', + }) + screen:expect([[ + {7: }abcdefghijklmnopqrstuvwxy^z | + {7: }{16:12αβ̳γ̲口=❤️345678} | + {7: }{1:123 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }bcdefghijklmnopqrstuvwxy^z | + {7: }{16:2αβ̳γ̲口=❤️345678} | + {7: }{1:23 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }cdefghijklmnopqrstuvwxy^z | + {7: }{16:αβ̳γ̲口=❤️345678} | + {7: }{1:3 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }defghijklmnopqrstuvwxy^z | + {7: }{16:β̳γ̲口=❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }efghijklmnopqrstuvwxy^z | + {7: }{16:γ̲口=❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }fghijklmnopqrstuvwxy^z | + {7: }{16:口=❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }ghijklmnopqrstuvwxy^z | + {7: }{16: =❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }hijklmnopqrstuvwxy^z | + {7: }{16:=❤️345678} | + {7: }{1: 45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }ijklmnopqrstuvwxy^z | + {7: }{16:❤️345678} | + {7: }{1:45 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }jklmnopqrstuvwxy^z | + {7: }{16: 345678} | + {7: }{1:5 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }klmnopqrstuvwxy^z | + {7: }{16:345678} | + {7: }{1: 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }lmnopqrstuvwxy^z | + {7: }{16:45678} | + {7: }{1: 678} | + {1:~ }|*8 + | + ]]) + feed('zl') + screen:expect([[ + {7: }mnopqrstuvwxy^z | + {7: }{16:5678} | + {7: }{1: 678} | + {1:~ }|*8 + | + ]]) + api.nvim_buf_set_extmark(0, ns, 0, 1, { + virt_lines = { { { '123\t45\t67', 'NonText' } } }, + virt_lines_leftcol = true, + virt_lines_overflow = 'trunc', + }) + api.nvim_buf_set_extmark(0, ns, 0, 2, { + virt_lines = { { { '123\t45\t6', 'NonText' } } }, + virt_lines_leftcol = false, + virt_lines_overflow = 'trunc', + }) + screen:expect([[ + {7: }mnopqrstuvwxy^z | + {7: }{16:5678} | + {7: }{1: 678} | + {1:123 45 67} | + {7: }{1:123 45 6} | + {1:~ }|*6 + | + ]]) + end) + it('does not show twice if end_row or end_col is specified #18622', function() screen:try_resize(50, 8) insert([[ |