Fix float position with g:lsp_preview_keep_focus=0 (#419)

This commit is contained in:
Andrej Zieger
2019-06-27 00:11:42 +01:00
committed by Prabir Shrestha
parent d848083ca1
commit ba9e9b5a20

View File

@@ -202,10 +202,8 @@ function! lsp#ui#vim#output#preview(data) abort
let l:bufferlines = line('$')
let l:maxwidth = max(map(getline(1, '$'), 'strdisplaywidth(v:val)'))
if g:lsp_preview_keep_focus
" restore focus to the previous window
call win_gotoid(l:current_window_id)
endif
" restore focus to the previous window
call win_gotoid(l:current_window_id)
echo ''
@@ -216,6 +214,11 @@ function! lsp#ui#vim#output#preview(data) abort
endif
doautocmd User lsp_float_opened
endif
if !g:lsp_preview_keep_focus
" set the focus to the preview window
call win_gotoid(s:winid)
endif
return ''
endfunction