Skip to content

Commit 08f7668

Browse files
committed
💪 Close all the popup windows when the mapping is restored
1 parent 9c7299d commit 08f7668

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

autoload/fall/command/Fall.vim

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ function! fall#command#Fall#call(args)
1414
silent! call fall#internal#msgarea#show()
1515
silent! call fall#internal#cursor#show()
1616
" Close all popup windows in case of denops death
17-
silent! call fall#internal#popup#close(g:_fall_component_preview_winid)
18-
silent! call fall#internal#popup#close(g:_fall_component_select_winid)
19-
silent! call fall#internal#popup#close(g:_fall_component_query_winid)
20-
silent! call fall#internal#popup#close(g:_fall_component_input_winid)
17+
silent! call fall#internal#popup#closeall()
2118
let &laststatus = l:laststatus_saved
2219
endtry
2320
endfunction

autoload/fall/command/FallRestore.vim

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ function! fall#command#FallRestore#call()
1414
call fall#internal#msgarea#show()
1515
call fall#internal#cursor#show()
1616
" Close all popup windows in case of denops death
17-
silent! call fall#internal#popup#close(g:_fall_component_preview_winid)
18-
silent! call fall#internal#popup#close(g:_fall_component_select_winid)
19-
silent! call fall#internal#popup#close(g:_fall_component_query_winid)
20-
silent! call fall#internal#popup#close(g:_fall_component_input_winid)
17+
silent! call fall#internal#popup#closeall()
2118
let &laststatus = l:laststatus_saved
2219
endtry
2320
endfunction

autoload/fall/internal/popup.vim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
function! fall#internal#popup#close(winid) abort
2-
call s:close(a:winid)
1+
function! fall#internal#popup#closeall() abort
2+
let l:winids = range(1, winnr('$'))
3+
\ ->map({_, v -> win_getid(v)})
4+
\ ->filter({_, v -> win_gettype(v) ==# 'popup'})
5+
call foreach(l:winids, {_, v -> s:close(v)})
36
endfunction
47

58
if has('nvim')

0 commit comments

Comments
 (0)