aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-01-16 18:44:28 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-01-16 19:54:27 +0800
commitbe15ac06badbea6b11390ad7d9c2ddd4aea73480 (patch)
tree34a1c9fa827b7e51f82272cbe7ef6af2f3f98494 /test/functional/api/vim_spec.lua
parent7085e5b0c8588618e643c87802afc515f67812d9 (diff)
downloadrneovim-be15ac06badbea6b11390ad7d9c2ddd4aea73480.tar.gz
rneovim-be15ac06badbea6b11390ad7d9c2ddd4aea73480.tar.bz2
rneovim-be15ac06badbea6b11390ad7d9c2ddd4aea73480.zip
feat(statusline): support multibyte fillchar
This includes a partial port of Vim patch 8.2.2569 and some changes to nvim_eval_statusline() to allow a multibyte fillchar. Literally every line of C code touched by that patch has been refactored in Nvim, and that patch contains some irrelevant foldcolumn tests I'm not sure how to port (as Nvim's foldcolumn behavior has diverged from Vim's).
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 22201e21a2..886915dfb4 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -2551,6 +2551,34 @@ describe('API', function()
'Should be truncated%<',
{ maxwidth = 15 }))
end)
+ it('supports ASCII fillchar', function()
+ eq({ str = 'a~~~b', width = 5 },
+ meths.eval_statusline('a%=b', { fillchar = '~', maxwidth = 5 }))
+ end)
+ it('supports single-width multibyte fillchar', 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 = '哦' }))
+ end)
+ it('rejects control character fillchar', function()
+ eq('fillchar must be a single-width character',
+ pcall_err(meths.eval_statusline, '', { fillchar = '\a' }))
+ end)
+ it('rejects multiple-character fillchar', function()
+ eq('fillchar must be a single-width character',
+ pcall_err(meths.eval_statusline, '', { fillchar = 'aa' }))
+ end)
+ it('rejects empty string fillchar', function()
+ eq('fillchar must be a single-width character',
+ pcall_err(meths.eval_statusline, '', { fillchar = '' }))
+ end)
+ it('rejects non-string fillchar', function()
+ eq('fillchar must be a single-width character',
+ pcall_err(meths.eval_statusline, '', { fillchar = 1 }))
+ end)
describe('highlight parsing', function()
it('works', function()
eq({