neovim: support global statusline and do not truncate too early

With Neovims recent merge of a global statusline (e.g. a statusline that
is the same across all windows), make sure that truncation only happens,
by checking the complete terminal window width instead of using the Vim
window width (similar to when using g:airline_statusline_ontop).

related: #2517
This commit is contained in:
Christian Brabandt
2022-03-23 19:40:21 +01:00
parent e2498d72dc
commit 1d486430cc

View File

@@ -18,7 +18,9 @@ let s:focusgained_ignore_time = 0
" actually changed. " actually changed.
function! airline#util#winwidth(...) abort function! airline#util#winwidth(...) abort
let nr = get(a:000, 0, 0) let nr = get(a:000, 0, 0)
if get(g:, 'airline_statusline_ontop', 0) " When statusline is on top, or using global statusline for Neovim
" always return the number of columns
if get(g:, 'airline_statusline_ontop', 0) || &laststatus > 2
return &columns return &columns
else else
return winwidth(nr) return winwidth(nr)