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 winnr = str2nr(winnr_str)
let is_win_moved = !(winnr is# winnr()) let is_win_moved = !(winnr is# winnr())
if is_win_moved if is_win_moved
doautocmd WinLeave * if exists('#WinLeave')
doautocmd WinLeave *
endif
call s:move_to_win(winnr) call s:move_to_win(winnr)
else else
normal! m` normal! m`
endif endif
call cursor(pos) call cursor(pos)
if is_win_moved if is_win_moved && exists('#WinEnter')
doautocmd WinEnter * doautocmd WinEnter *
endif endif
endfunction endfunction