From 3011794c8600f529bc049983a64ca99ae03908df Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 10 Mar 2022 07:18:49 +0800 Subject: feat(api): relax statusline fillchar width check Treat fillchar as single-width even if it isn't. --- test/functional/api/vim_spec.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test') 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() -- cgit