main: ignore popup windows for inactive windows

When openning popup (vim) or floating (neovim) windows,
do not consider those windows for disabled windows. That is, leave the
main window in activate state instead of marking it disabled

closes: #2387
This commit is contained in:
Gauravsingh Sisodia 2021-12-04 01:24:26 +05:30 committed by Christian Brabandt
parent de73a21903
commit 8e36c0a8ed
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 11 additions and 1 deletions

View File

@ -142,9 +142,10 @@ endfunction
" Update the statusline
function! airline#update_statusline()
if airline#util#stl_disabled(winnr())
if airline#util#stl_disabled(winnr()) || airline#util#is_popup_window(winnr())
return
endif
" TODO: need to ignore popup windows here as well?
let range = filter(range(1, winnr('$')), 'v:val != winnr()')
" create inactive statusline
call airline#update_statusline_inactive(range)

View File

@ -204,6 +204,15 @@ function! airline#util#ignore_next_focusgain()
endif
endfunction
function! airline#util#is_popup_window(winnr)
" Keep the statusline active if it's a popup window
if exists('*win_gettype')
return win_gettype(a:winnr) ==# 'popup' || win_gettype(a:winnr) ==# 'autocmd'
else
return getwinvar(a:winnr, '&buftype', '') ==# 'popup'
endif
endfunction
function! airline#util#try_focusgained()
" Ignore lasts for at most one second and is cleared on the first
" focusgained. We use ignore to prevent system() calls from triggering