mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
fix(statusline): make nvim_eval_statusline() work with %S (#21553)
This commit is contained in:
@@ -1505,7 +1505,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case STL_SHOWCMD:
|
case STL_SHOWCMD:
|
||||||
if (p_sc && strcmp(opt_name, p_sloc) == 0) {
|
if (p_sc && (opt_name == NULL || strcmp(opt_name, p_sloc) == 0)) {
|
||||||
str = showcmd_buf;
|
str = showcmd_buf;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -3126,6 +3126,19 @@ describe('API', function()
|
|||||||
eq('E539: Illegal character <}>',
|
eq('E539: Illegal character <}>',
|
||||||
pcall_err(meths.eval_statusline, '%{%}', {}))
|
pcall_err(meths.eval_statusline, '%{%}', {}))
|
||||||
end)
|
end)
|
||||||
|
it('supports %S item', function()
|
||||||
|
local screen = Screen.new(80, 24)
|
||||||
|
screen:attach()
|
||||||
|
command('set showcmd')
|
||||||
|
feed('1234')
|
||||||
|
screen:expect({any = '1234'})
|
||||||
|
eq({ str = '1234', width = 4 },
|
||||||
|
meths.eval_statusline('%S', { maxwidth = 5 }))
|
||||||
|
feed('56')
|
||||||
|
screen:expect({any = '123456'})
|
||||||
|
eq({ str = '<3456', width = 5 },
|
||||||
|
meths.eval_statusline('%S', { maxwidth = 5 }))
|
||||||
|
end)
|
||||||
describe('highlight parsing', function()
|
describe('highlight parsing', function()
|
||||||
it('works', function()
|
it('works', function()
|
||||||
eq({
|
eq({
|
||||||
|
Reference in New Issue
Block a user