1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 23:49:19 +08:00

Update windows count

This commit is contained in:
Shidong Wang 2021-02-10 16:29:03 +08:00
parent 14392bd943
commit c04a196331
2 changed files with 17 additions and 3 deletions

View File

@ -64,7 +64,8 @@ endf
function! s:self._getchar(...) abort
let ret = call('getchar', a:000)
" @bug getchar() does not work for <
" getchar() does not work for < in old version of
" neovim-qt.
" https://github.com/neovim/neovim/issues/12487
if ret ==# "\x80\xfc\<C-b><"
return '<'

View File

@ -292,9 +292,22 @@ endfunction
fu! SpaceVim#mapping#SmartClose() abort
let ignorewin = get(g:,'spacevim_smartcloseignorewin',[])
let ignoreft = get(g:, 'spacevim_smartcloseignoreft',[])
" @bug vim winnr('$') do not include popup
" in vim winnr('$') do not include popup.
" so we need to check the popuplist
" ref: https://github.com/vim/vim/issues/6474
let win_count = winnr('$')
if !has('nvim')
\ && exists('*popup_list')
\ && exists('*popup_getoptions')
\ && exists('*popup_getpos')
let popup_count = len(
\ filter(
\ map(
\ filter(popup_list(), 'popup_getpos(v:val).visible'),
\ 'popup_getoptions(v:val).tabpage'),
\ 'v:val == -1 || v:val ==0'))
else
let win_count = winnr('$')
endif
let num = win_count
for i in range(1,win_count)
if index(ignorewin , bufname(winbufnr(i))) != -1 || index(ignoreft, getbufvar(bufname(winbufnr(i)),'&filetype')) != -1