Fix traceback when opening popup in neovim with log visible
* We enter the popup window * some log data is received, so we update the log buffer and jump to the log window to scroll it * meanwhile, the WinLeave auto command on the popup window fires and closes the popup window * Having scrolled the log window, we try to jump back to the popup window, which by now has been closed. Fixes #390
This commit is contained in:
parent
a47d0b921c
commit
0c88cc8bad
1 changed files with 5 additions and 4 deletions
|
|
@ -159,15 +159,16 @@ function! s:_OnCommandEvent( category, id, data, event ) abort
|
||||||
call setbufvar( buffer, '&modified', 0 )
|
call setbufvar( buffer, '&modified', 0 )
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
" if the buffer is visible, scroll it
|
" if the buffer is visible, scroll it, but don't allow autocommands to fire,
|
||||||
|
" as this may close the current window!
|
||||||
let w = bufwinnr( buffer )
|
let w = bufwinnr( buffer )
|
||||||
if w > 0
|
if w > 0
|
||||||
let cw = winnr()
|
let cw = winnr()
|
||||||
try
|
try
|
||||||
execute w . 'wincmd w'
|
noautocmd execute w . 'wincmd w'
|
||||||
normal! Gz-
|
noautocmd normal! Gz-
|
||||||
finally
|
finally
|
||||||
execute cw . 'wincmd w'
|
noautocmd execute cw . 'wincmd w'
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
elseif a:event ==# 'exit'
|
elseif a:event ==# 'exit'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue