aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/legacy/breakindent_spec.lua13
-rw-r--r--test/functional/ui/decorations_spec.lua334
2 files changed, 226 insertions, 121 deletions
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
index ecd2d47f47..3913ba935a 100644
--- a/test/functional/legacy/breakindent_spec.lua
+++ b/test/functional/legacy/breakindent_spec.lua
@@ -21,7 +21,6 @@ describe('breakindent', function()
set listchars=eol:$
let &signcolumn = 'yes'
let &showbreak = '++'
- let &breakindent = v:true
let &breakindentopt = 'shift:2'
let leftcol = win_getid()->getwininfo()->get(0, {})->get('textoff')
eval repeat('x', &columns - leftcol - 1)->setline(1)
@@ -39,6 +38,9 @@ describe('breakindent', function()
-- No line wraps, so changing 'showbreak' should lead to the same screen.
command('setlocal showbreak=+')
screen:expect_unchanged()
+ -- No line wraps, so setting 'breakindent' should lead to the same screen.
+ command('setlocal breakindent')
+ screen:expect_unchanged()
-- The first line now wraps because of "eol" in 'listchars'.
command('setlocal list')
screen:expect{grid=[[
@@ -49,5 +51,14 @@ describe('breakindent', function()
{0:~ }|
{2:-- INSERT --} |
]]}
+ command('setlocal nobreakindent')
+ screen:expect{grid=[[
+ {1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
+ {1: }{0:+^$} |
+ {1: }second line{0:$} |
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
+ ]]}
end)
end)
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 0dd8fd8ad9..63f8c1e82c 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -1976,91 +1976,100 @@ describe('decorations: inline virtual text', function()
end)
it('text is drawn correctly with a wrapping virtual text', function()
- screen:try_resize(50, 8)
- feed('o<esc>')
- insert([[aaaaaaa
-
-bbbbbbb]])
- meths.buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('X', 51), 'Special' } }, virt_text_pos = 'inline' })
- meths.buf_set_extmark(0, ns, 2, 0, { virt_text = { { string.rep('X', 50), 'Special' } }, virt_text_pos = 'inline' })
- feed('gg0')
+ screen:try_resize(60, 8)
+ exec([[
+ call setline(1, ['', 'aaa', '', 'bbbbbb'])
+ normal gg0
+ ]])
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_text = { { string.rep('X', 60), 'Special' } }, virt_text_pos = 'inline' })
+ meths.buf_set_extmark(0, ns, 2, 0, { virt_text = { { string.rep('X', 61), 'Special' } }, virt_text_pos = 'inline' })
+ feed('$')
screen:expect{grid=[[
- {10:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
- {10:X} |
- aaaaaaa |
- {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
- bbbbbbb |
- {1:~ }|
- {1:~ }|
- |
- ]]}
-
+ {10:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ aaa |
+ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {10:X} |
+ bbbbbb |
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
feed('j')
screen:expect{grid=[[
- {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
- {10:X} |
- ^aaaaaaa |
- {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
- bbbbbbb |
- {1:~ }|
- {1:~ }|
- |
+ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ aa^a |
+ {10:XXXXX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XXX}|
- bbbbbbb |
- {1:~ }|
- {1:~ }|
- {8:-- INSERT --} |
+ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {7:aa}^a |
+ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {10:X} |
+ {7:bbb}bbb |
+ {1:~ }|
+ {1:~ }|
+ {8:-- VISUAL BLOCK --} |
]]}
- end)
-
- it('regexp \\%V does not count trailing virtual text', function()
- screen:try_resize(50, 4)
- meths.buf_set_lines(0, 0, -1, true, {'foofoo', '', 'foofoo'})
- meths.buf_set_extmark(0, ns, 1, 0, { virt_text = {{'barbarbar', 'Special'}}, virt_text_pos = 'inline' })
- feed([[<C-V>G5l<Esc>/foo\n\%V<CR>]])
+ feed([[<Esc>/aaa\n\%V<CR>]])
screen:expect{grid=[[
- foo{12:^foo } |
- {10:barbarbar} |
- foofoo |
- {16:search hit BOTTOM, continuing at TOP} |
+ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {12:^aaa } |
+ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {10:X} |
+ bbbbbb |
+ {1:~ }|
+ {1:~ }|
+ {16:search hit BOTTOM, continuing at TOP} |
+ ]]}
+ feed('3ggic')
+ screen:expect{grid=[[
+ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {12:aaa } |
+ c{10:^XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {10:XX} |
+ bbbbbb |
+ {1:~ }|
+ {1:~ }|
+ {8:-- INSERT --} |
]]}
- feed([[jIbaz<Esc>/foo\nbaz\%V<CR>]])
+ feed([[<Esc>/aaa\nc\%V<CR>]])
screen:expect{grid=[[
- foo{12:^foo } |
- {12:baz}{10:barbarbar} |
- foofoo |
- {16:search hit BOTTOM, continuing at TOP} |
+ {10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {12:^aaa } |
+ {12:c}{10:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {10:XX} |
+ bbbbbb |
+ {1:~ }|
+ {1:~ }|
+ {16:search hit BOTTOM, continuing at TOP} |
]]}
end)
@@ -2209,111 +2218,119 @@ bbbbbbb]])
end)
it('cursor position is correct when inserting around a virtual text with left gravity', function()
- insert('foo foo foo foo')
- meths.buf_set_extmark(0, ns, 0, 8, { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline', right_gravity = false })
- feed('0')
- feed('8l')
+ screen:try_resize(27, 4)
+ insert(('a'):rep(15))
+ meths.buf_set_extmark(0, ns, 0, 8, { virt_text = { { ('>'):rep(43), 'Special' } }, virt_text_pos = 'inline', right_gravity = false })
+ command('setlocal showbreak=+ breakindent breakindentopt=shift:2')
+ feed('08l')
screen:expect{grid=[[
- foo foo {10:virtual text}^foo foo |
- {1:~ }|
- |
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}^aaaaaaa |
+ |
]]}
-
feed('i')
screen:expect{grid=[[
- foo foo {10:virtual text}^foo foo |
- {1:~ }|
- {8:-- INSERT --} |
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}^aaaaaaa |
+ {8:-- INSERT --} |
]]}
-
feed([[<C-\><C-O>]])
screen:expect{grid=[[
- foo foo {10:virtual text}^foo foo |
- {1:~ }|
- {8:-- (insert) --} |
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}^aaaaaaa |
+ {8:-- (insert) --} |
]]}
-
feed('D')
screen:expect{grid=[[
- foo foo {10:virtual text}^ |
- {1:~ }|
- {8:-- INSERT --} |
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:^~ }|
+ {8:-- INSERT --} |
+ ]]}
+ command('setlocal list listchars=eol:$')
+ screen:expect{grid=[[
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+^$} |
+ {8:-- INSERT --} |
]]}
-
feed('<C-U>')
screen:expect{grid=[[
- {10:virtual text}^ |
- {1:~ }|
- {8:-- INSERT --} |
+ {10:>>>>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>}{1:^$} |
+ {1:~ }|
+ {8:-- INSERT --} |
]]}
-
feed('a')
screen:expect{grid=[[
- {10:virtual text}a^ |
- {1:~ }|
- {8:-- INSERT --} |
+ {10:>>>>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>}a{1:^$} |
+ {1:~ }|
+ {8:-- INSERT --} |
]]}
-
feed('<Esc>')
screen:expect{grid=[[
- {10:virtual text}^a |
- {1:~ }|
- |
+ {10:>>>>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>}^a{1:$} |
+ {1:~ }|
+ |
]]}
-
feed('x')
screen:expect{grid=[[
- {10:^virtual text} |
- {1:~ }|
- |
+ {10:^>>>>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>>>>>>>>>>>>>>>}{1:$} |
+ {1:~ }|
+ |
]]}
end)
it('cursor position is correct when inserting around virtual texts with both left and right gravity', function()
screen:try_resize(30, 4)
command('setlocal showbreak=+ breakindent breakindentopt=shift:2')
- insert('foo foo foo foo')
+ insert(('a'):rep(15))
meths.buf_set_extmark(0, ns, 0, 8, { virt_text = {{ ('>'):rep(32), 'Special' }}, virt_text_pos = 'inline', right_gravity = false })
meths.buf_set_extmark(0, ns, 0, 8, { virt_text = {{ ('<'):rep(32), 'Special' }}, virt_text_pos = 'inline', right_gravity = true })
-
feed('08l')
screen:expect{grid=[[
- foo foo {10:>>>>>>>>>>>>>>>>>>>>>>}|
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>>>>}|
{1:+}{10:>>>>>>>>>><<<<<<<<<<<<<<<<<}|
- {1:+}{10:<<<<<<<<<<<<<<<}^foo foo |
+ {1:+}{10:<<<<<<<<<<<<<<<}^aaaaaaa |
|
]]}
feed('i')
screen:expect{grid=[[
- foo foo {10:>>>>>>>>>>>>>>>>>>>>>>}|
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>>>>}|
{1:+}{10:>>>>>>>>>>^<<<<<<<<<<<<<<<<<}|
- {1:+}{10:<<<<<<<<<<<<<<<}foo foo |
+ {1:+}{10:<<<<<<<<<<<<<<<}aaaaaaa |
{8:-- INSERT --} |
]]}
feed('a')
screen:expect{grid=[[
- foo foo {10:>>>>>>>>>>>>>>>>>>>>>>}|
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>>>>}|
{1:+}{10:>>>>>>>>>>}a{10:^<<<<<<<<<<<<<<<<}|
- {1:+}{10:<<<<<<<<<<<<<<<<}foo foo |
+ {1:+}{10:<<<<<<<<<<<<<<<<}aaaaaaa |
{8:-- INSERT --} |
]]}
feed([[<C-\><C-O>]])
screen:expect{grid=[[
- foo foo {10:>>>>>>>>>>>>>>>>>>>>>>}|
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>>>>}|
{1:+}{10:>>>>>>>>>>}a{10:<<<<<<<<<<<<<<<<}|
- {1:+}{10:<<<<<<<<<<<<<<<<}^foo foo |
+ {1:+}{10:<<<<<<<<<<<<<<<<}^aaaaaaa |
{8:-- (insert) --} |
]]}
feed('D')
screen:expect{grid=[[
- foo foo {10:>>>>>>>>>>>>>>>>>>>>>>}|
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>>>>}|
{1:+}{10:>>>>>>>>>>}a{10:^<<<<<<<<<<<<<<<<}|
{1:+}{10:<<<<<<<<<<<<<<<<} |
{8:-- INSERT --} |
]]}
feed('<BS>')
screen:expect{grid=[[
- foo foo {10:>>>>>>>>>>>>>>>>>>>>>>}|
+ aaaaaaaa{10:>>>>>>>>>>>>>>>>>>>>>>}|
{1:+}{10:>>>>>>>>>>^<<<<<<<<<<<<<<<<<}|
{1:+}{10:<<<<<<<<<<<<<<<} |
{8:-- INSERT --} |
@@ -2346,6 +2363,27 @@ bbbbbbb]])
{1:+}{10:<<<<<<<} |
|
]]}
+ feed('i')
+ screen:expect{grid=[[
+ {10:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:>>^<<<<<<<<<<<<<<<<<<<<<<<<<}|
+ {1:+}{10:<<<<<<<} |
+ {8:-- INSERT --} |
+ ]]}
+ screen:try_resize(32, 4)
+ screen:expect{grid=[[
+ {10:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<}|
+ {1:+}{10:<<<} |
+ {8:-- INSERT --} |
+ ]]}
+ command('setlocal nobreakindent')
+ screen:expect{grid=[[
+ {10:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}|
+ {1:+}{10:^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<}|
+ {1:+}{10:<} |
+ {8:-- INSERT --} |
+ ]]}
end)
it('draws correctly with no wrap multiple virtual text, where one is hidden', function()
@@ -2639,7 +2677,45 @@ bbbbbbb]])
]]}
end)
- it('list "extends" is drawn with only inline virtual text offscreen', function()
+ it('lcs-extends is drawn with inline virtual text at end of screen line', function()
+ exec([[
+ setlocal nowrap list listchars=extends:!
+ call setline(1, repeat('a', 51))
+ ]])
+ meths.buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' })
+ feed('20l')
+ screen:expect{grid=[[
+ aaaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:!}|
+ {1:~ }|
+ |
+ ]]}
+ feed('zl')
+ screen:expect{grid=[[
+ aaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:!}|
+ {1:~ }|
+ |
+ ]]}
+ feed('zl')
+ screen:expect{grid=[[
+ aaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{10:b}{1:!}|
+ {1:~ }|
+ |
+ ]]}
+ feed('zl')
+ screen:expect{grid=[[
+ aaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{10:bb}{1:!}|
+ {1:~ }|
+ |
+ ]]}
+ feed('zl')
+ screen:expect{grid=[[
+ aaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{10:bbb}a|
+ {1:~ }|
+ |
+ ]]}
+ end)
+
+ it('lcs-extends is drawn with only inline virtual text offscreen', function()
command('set nowrap')
command('set list')
command('set listchars+=extends:c')
@@ -2797,9 +2873,9 @@ bbbbbbb]])
screen:try_resize(30, 6)
exec([[
highlight! link LineNr Normal
- call setline(1, repeat('a', 28))
setlocal number showbreak=+ breakindent breakindentopt=shift:2
setlocal scrolloff=0 smoothscroll
+ call setline(1, repeat('a', 28))
normal! $
]])
meths.buf_set_extmark(0, ns, 0, 27, { virt_text = { { ('123'):rep(23) } }, virt_text_pos = 'inline' })
@@ -3002,6 +3078,24 @@ bbbbbbb]])
{1:~ }|
|
]]}
+ feed('26ia<Esc>a')
+ screen:expect{grid=[[
+ 1 aaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {1:+}^12312312312312312312312|
+ {1:+}31231231231231231231231|
+ {1:+}23123123123123123123123|
+ {1:~ }|
+ {8:-- INSERT --} |
+ ]]}
+ feed([[<C-\><C-O>:setlocal breakindentopt=<CR>]])
+ screen:expect{grid=[[
+ 1 aaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {1:+}^1231231231231231231231231|
+ {1:+}2312312312312312312312312|
+ {1:+}3123123123123123123 |
+ {1:~ }|
+ {8:-- INSERT --} |
+ ]]}
end
describe('with showbreak, smoothscroll', function()
@@ -3019,8 +3113,8 @@ bbbbbbb]])
it('before TABs with smoothscroll', function()
screen:try_resize(30, 6)
exec([[
- call setline(1, repeat("\t", 4) .. 'a')
setlocal list listchars=tab:<-> scrolloff=0 smoothscroll
+ call setline(1, repeat("\t", 4) .. 'a')
normal! $
]])
meths.buf_set_extmark(0, ns, 0, 3, { virt_text = { { ('12'):rep(32) } }, virt_text_pos = 'inline' })