Make sure the autocmd event exists before doautocmd

This commit is contained in:
haya14busa 2016-01-21 17:21:43 +09:00
parent 65ee835a4e
commit fc7d1d9a5d

View File

@ -106,13 +106,15 @@ function! s:move_to_winpos(winpos) abort
let winnr = str2nr(winnr_str)
let is_win_moved = !(winnr is# winnr())
if is_win_moved
doautocmd WinLeave *
if exists('#WinLeave')
doautocmd WinLeave *
endif
call s:move_to_win(winnr)
else
normal! m`
endif
call cursor(pos)
if is_win_moved
if is_win_moved && exists('#WinEnter')
doautocmd WinEnter *
endif
endfunction