aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/vim_spec.lua18
-rw-r--r--test/functional/editor/completion_spec.lua19
-rw-r--r--test/functional/editor/put_spec.lua4
-rw-r--r--test/functional/provider/clipboard_spec.lua16
-rw-r--r--test/functional/ui/decorations_spec.lua96
-rw-r--r--test/functional/ui/sign_spec.lua2
6 files changed, 137 insertions, 18 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 71cd055e08..e945a6c706 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -2621,24 +2621,24 @@ describe('API', function()
eq({ str = 'a━━━b', width = 5 },
meths.eval_statusline('a%=b', { fillchar = '━', maxwidth = 5 }))
end)
- it('rejects double-width fillchar', function()
- eq('fillchar must be a single-width character',
- pcall_err(meths.eval_statusline, '', { fillchar = '哦' }))
+ it('treats double-width fillchar as single-width', function()
+ eq({ str = 'a哦哦哦b', width = 5 },
+ meths.eval_statusline('a%=b', { fillchar = '哦', maxwidth = 5 }))
end)
- it('rejects control character fillchar', function()
- eq('fillchar must be a single-width character',
- pcall_err(meths.eval_statusline, '', { fillchar = '\a' }))
+ it('treats control character fillchar as single-width', function()
+ eq({ str = 'a\031\031\031b', width = 5 },
+ meths.eval_statusline('a%=b', { fillchar = '\031', maxwidth = 5 }))
end)
it('rejects multiple-character fillchar', function()
- eq('fillchar must be a single-width character',
+ eq('fillchar must be a single character',
pcall_err(meths.eval_statusline, '', { fillchar = 'aa' }))
end)
it('rejects empty string fillchar', function()
- eq('fillchar must be a single-width character',
+ eq('fillchar must be a single character',
pcall_err(meths.eval_statusline, '', { fillchar = '' }))
end)
it('rejects non-string fillchar', function()
- eq('fillchar must be a single-width character',
+ eq('fillchar must be a single character',
pcall_err(meths.eval_statusline, '', { fillchar = 1 }))
end)
describe('highlight parsing', function()
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua
index befad29922..1a0ee54505 100644
--- a/test/functional/editor/completion_spec.lua
+++ b/test/functional/editor/completion_spec.lua
@@ -1193,4 +1193,23 @@ describe('completion', function()
eq('foobar', eval('g:word'))
feed('<esc>')
end)
+
+ it('does not crash if text is changed by first call to complete function #17489', function()
+ source([[
+ func Complete(findstart, base) abort
+ if a:findstart
+ let col = col('.')
+ call complete_add('#')
+ return col - 1
+ else
+ return []
+ endif
+ endfunc
+
+ set completeopt=longest
+ set completefunc=Complete
+ ]])
+ feed('ifoo#<C-X><C-U>')
+ assert_alive()
+ end)
end)
diff --git a/test/functional/editor/put_spec.lua b/test/functional/editor/put_spec.lua
index c367f8fdd0..cc9fce8f67 100644
--- a/test/functional/editor/put_spec.lua
+++ b/test/functional/editor/put_spec.lua
@@ -138,9 +138,9 @@ describe('put command', function()
end -- create_test_defs() }}}
local function find_cursor_position(expect_string) -- {{{
- -- There must only be one occurance of the character 'x' in
+ -- There must only be one occurrence of the character 'x' in
-- expect_string.
- -- This function removes that occurance, and returns the position that
+ -- This function removes that occurrence, and returns the position that
-- it was in.
-- This returns the cursor position that would leave the 'x' in that
-- place if we feed 'ix<esc>' and the string existed before it.
diff --git a/test/functional/provider/clipboard_spec.lua b/test/functional/provider/clipboard_spec.lua
index 986db96a18..5bdfec574e 100644
--- a/test/functional/provider/clipboard_spec.lua
+++ b/test/functional/provider/clipboard_spec.lua
@@ -50,29 +50,33 @@ local function basic_register_test(noblock)
text, stuff and some more
some some text, stuff and some more]])
- -- deleting a word to named ("a) updates "1 (and not "-)
+ -- deleting a word to named ("a) doesn't update "1 or "-
feed('gg"adwj"1P^"-P')
expect([[
, stuff and some more
- some textsome some text, stuff and some more]])
+ some some random text
+ some some text, stuff and some more]])
-- deleting a line does update ""
feed('ggdd""P')
expect([[
, stuff and some more
- some textsome some text, stuff and some more]])
+ some some random text
+ some some text, stuff and some more]])
feed('ggw<c-v>jwyggP')
if noblock then
expect([[
stuf
- me t
+ me s
, stuff and some more
- some textsome some text, stuff and some more]])
+ some some random text
+ some some text, stuff and some more]])
else
expect([[
stuf, stuff and some more
- me tsome textsome some text, stuff and some more]])
+ me ssome some random text
+ some some text, stuff and some more]])
end
-- pasting in visual does unnamed delete of visual selection
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index ae5d34fa7a..7e71ada02d 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -1372,6 +1372,7 @@ describe('decorations: signs', function()
screen:set_default_attr_ids {
[1] = {foreground = Screen.colors.Blue4, background = Screen.colors.Grey};
[2] = {foreground = Screen.colors.Blue1, bold = true};
+ [3] = {background = Screen.colors.Yellow1, foreground = Screen.colors.Blue1};
}
ns = meths.create_namespace 'test'
@@ -1634,4 +1635,99 @@ l5
end)
+ it('can add lots of signs', function()
+ screen:try_resize(40, 10)
+ command 'normal 10oa b c d e f g h'
+
+ for i = 1, 10 do
+ meths.buf_set_extmark(0, ns, i, 0, { end_col = 1, hl_group='Todo' })
+ meths.buf_set_extmark(0, ns, i, 2, { end_col = 3, hl_group='Todo' })
+ meths.buf_set_extmark(0, ns, i, 4, { end_col = 5, hl_group='Todo' })
+ meths.buf_set_extmark(0, ns, i, 6, { end_col = 7, hl_group='Todo' })
+ meths.buf_set_extmark(0, ns, i, 8, { end_col = 9, hl_group='Todo' })
+ meths.buf_set_extmark(0, ns, i, 10, { end_col = 11, hl_group='Todo' })
+ meths.buf_set_extmark(0, ns, i, 12, { end_col = 13, hl_group='Todo' })
+ meths.buf_set_extmark(0, ns, i, 14, { end_col = 15, hl_group='Todo' })
+ meths.buf_set_extmark(0, ns, i, -1, { sign_text='W' })
+ meths.buf_set_extmark(0, ns, i, -1, { sign_text='X' })
+ meths.buf_set_extmark(0, ns, i, -1, { sign_text='Y' })
+ meths.buf_set_extmark(0, ns, i, -1, { sign_text='Z' })
+ end
+
+ screen:expect{grid=[[
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} |
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} |
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} |
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} |
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} |
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} |
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} |
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} |
+ X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:^h} |
+ |
+ ]]}
+ end)
+
+end)
+
+describe('decorations: virt_text', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(50, 10)
+ screen:attach()
+ screen:set_default_attr_ids {
+ [1] = {foreground = Screen.colors.Brown};
+ [2] = {foreground = Screen.colors.Fuchsia};
+ [3] = {bold = true, foreground = Screen.colors.Blue1};
+ }
+ end)
+
+ it('avoids regression in #17638', function()
+ exec_lua[[
+ vim.wo.number = true
+ vim.wo.relativenumber = true
+ ]]
+
+ command 'normal 4ohello'
+ command 'normal aVIRTUAL'
+
+ local ns = meths.create_namespace('test')
+
+ meths.buf_set_extmark(0, ns, 2, 0, {
+ virt_text = {{"hello", "String"}},
+ virt_text_win_col = 20,
+ })
+
+ screen:expect{grid=[[
+ {1: 4 } |
+ {1: 3 }hello |
+ {1: 2 }hello {2:hello} |
+ {1: 1 }hello |
+ {1:5 }helloVIRTUA^L |
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ |
+ ]]}
+
+ -- Trigger a screen update
+ feed('k')
+
+ screen:expect{grid=[[
+ {1: 3 } |
+ {1: 2 }hello |
+ {1: 1 }hello {2:hello} |
+ {1:4 }hell^o |
+ {1: 1 }helloVIRTUAL |
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ {3:~ }|
+ |
+ ]]}
+ end)
+
end)
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index f718786557..dbc92ca222 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -482,7 +482,7 @@ describe('Signs', function()
]])
end)
- it('ignores signs with no icon and text when calculting the signcolumn width', function()
+ it('ignores signs with no icon and text when calculating the signcolumn width', function()
feed('ia<cr>b<cr>c<cr><esc>')
command('set number')
command('set signcolumn=auto:2')