fix(api): don't use stl 'fillchar' for "use_statuscol_lnum" (#27501)

Problem:  nvim_eval_statusline() uses "stl" from 'fillchars' with "use_statuscol_lnum".
Solution: Reorder "fillchar" else chain.
This commit is contained in:
luukvbaal 2024-02-17 00:44:31 +01:00 committed by GitHub
parent 478273a423
commit 5fd1bac65e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 40 deletions

View File

@ -2203,17 +2203,6 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Arena *
statuscol_T statuscol = { 0 };
SignTextAttrs sattrs[SIGN_SHOW_MAX] = { 0 };
if (opts->use_tabline) {
fillchar = schar_from_ascii(' ');
} else {
if (fillchar == 0) {
if (opts->use_winbar) {
fillchar = wp->w_p_fcs_chars.wbr;
} else {
int attr;
fillchar = fillchar_status(&attr, wp);
}
}
if (statuscol_lnum) {
int line_id = 0;
int cul_id = 0;
@ -2246,6 +2235,12 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Arena *
set_vim_var_nr(VV_LNUM, lnum);
set_vim_var_nr(VV_RELNUM, labs(get_cursor_rel_lnum(wp, lnum)));
set_vim_var_nr(VV_VIRTNUM, 0);
} else if (fillchar == 0 && !opts->use_tabline) {
if (opts->use_winbar) {
fillchar = wp->w_p_fcs_chars.wbr;
} else {
int attr;
fillchar = fillchar_status(&attr, wp);
}
}

View File

@ -3806,7 +3806,8 @@ describe('API', function()
it('works with statuscolumn', function()
exec([[
let &stc='%C%s%=%l '
set cul nu nuw=3 scl=yes:2 fdc=2
" should not use "stl" from 'fillchars'
set cul nu nuw=3 scl=yes:2 fdc=2 fillchars=stl:#
call setline(1, repeat(['aaaaa'], 5))
let g:ns = nvim_create_namespace('')
call sign_define('a', {'text':'aa', 'texthl':'IncSearch', 'numhl':'Normal'})