Skip to content

Commit

Permalink
fix: Make not to skip floatwin if it is focusable
Browse files Browse the repository at this point in the history
  • Loading branch information
4513ECHO committed Sep 3, 2023
1 parent b1e91b4 commit 4404a20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 11 additions & 6 deletions autoload/lightline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ set cpo&vim

let s:_ = 1 " 1: uninitialized, 2: disabled

function! lightline#update() abort
if s:skip() | return | endif
function! lightline#update(...) abort
if s:skip(get(a:000, 0, v:false)) | return | endif
if s:_
if s:_ == 2 | return | endif
call lightline#init()
Expand All @@ -26,12 +26,16 @@ function! lightline#update() abort
endif
endfunction

if exists('*win_gettype')
function! s:skip() abort " Vim 8.2.0257 (00f3b4e007), 8.2.0991 (0fe937fd86), 8.2.0996 (40a019f157)
if exists('*nvim_win_get_config')
function! s:skip(on_bufenter) abort
return !nvim_win_get_config(0).focusable || (a:on_bufenter && nvim_win_get_config(0).relative !=# '')
endfunction
elseif exists('*win_gettype')
function! s:skip(on_bufenter) abort " Vim 8.2.0257 (00f3b4e007), 8.2.0991 (0fe937fd86), 8.2.0996 (40a019f157)
return win_gettype() ==# 'popup' || win_gettype() ==# 'autocmd'
endfunction
else
function! s:skip() abort
function! s:skip(on_bufenter) abort
return &buftype ==# 'popup'
endfunction
endif
Expand All @@ -47,7 +51,8 @@ function! lightline#enable() abort
call lightline#update()
augroup lightline
autocmd!
autocmd WinEnter,BufEnter,SessionLoadPost,FileChangedShellPost * call lightline#update()
autocmd WinEnter,SessionLoadPost,FileChangedShellPost * call lightline#update()
autocmd BufEnter * call lightline#update(v:true)
if !has('patch-8.1.1715')
autocmd FileType qf call lightline#update()
endif
Expand Down
3 changes: 2 additions & 1 deletion plugin/lightline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ set cpo&vim

augroup lightline
autocmd!
autocmd WinEnter,BufEnter,SessionLoadPost,FileChangedShellPost * call lightline#update()
autocmd WinEnter,SessionLoadPost,FileChangedShellPost * call lightline#update()
autocmd BufEnter * call lightline#update(v:true)
if !has('patch-8.1.1715')
autocmd FileType qf call lightline#update()
endif
Expand Down

0 comments on commit 4404a20

Please sign in to comment.