Skip to content

Commit

Permalink
Fix immediate popup on start
Browse files Browse the repository at this point in the history
  • Loading branch information
rene-descartes2021 committed Dec 13, 2022
1 parent c0eb7a6 commit 10ed1e1
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions autoload/which_key.vim
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,19 @@ function! which_key#start(vis, bang, prefix) " {{{
" parsed by vim-which-key itself with user defined prefix dictionary if avaliable.
let s:runtime = s:create_runtime(mode, key)

if getchar(1)
while 1
try
let c = getchar()
catch /^Vim:Interrupt$/
return ''
endtry
if s:handle_char_on_start_is_ok(c)
return
endif
" When there are next level options, wait another timeoutlen.
" https://github.com/liuchengxu/vim-which-key/issues/3
" https://github.com/liuchengxu/vim-which-key/issues/4
if which_key#char_handler#wait_with_timeout()
break
endif
endwhile
endif
" When there are next level options, wait another timeoutlen.
" https://github.com/liuchengxu/vim-which-key/issues/3
" https://github.com/liuchengxu/vim-which-key/issues/4
while !which_key#char_handler#timeout_for_next_char()
try
let c = getchar()
catch /^Vim:Interrupt$/
return ''
endtry
if s:handle_char_on_start_is_ok(c)
return
endif
endwhile
endif

let s:last_runtime_stack = [copy(s:runtime)]
Expand Down

0 comments on commit 10ed1e1

Please sign in to comment.