Skip to content

Commit 5ccf450

Browse files
committed
Fix checking enough space for floating window
1 parent d63389f commit 5ccf450

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

autoload/LanguageClient.vim

+4-3
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,15 @@ function! s:CloseFloatingHoverAfterCursorMove(win_id, opened) abort
271271
endif
272272
autocmd! plugin-LC-neovim-close-hover
273273
let winnr = win_id2win(a:win_id)
274-
if winnr == -1
274+
if winnr == 0
275275
return
276276
endif
277277
execute winnr . 'wincmd c'
278278
endfunction
279279

280280
function! s:CloseFloatingHoverAfterEnterAnotherWin(win_id) abort
281281
let winnr = win_id2win(a:win_id)
282-
if winnr == -1
282+
if winnr == 0
283283
" Float window was already closed
284284
autocmd! plugin-LC-neovim-close-hover
285285
return
@@ -320,7 +320,8 @@ function! s:OpenHoverPreview(bufname, lines, filetype) abort
320320

321321
" Calculate anchor
322322
" Prefer North, but if there is no space, fallback into South
323-
if pos[1] + height <= &lines
323+
let bottom_line = line('w0') + winheight() - 1
324+
if pos[1] + height <= bottom_line
324325
let vert = 'N'
325326
let row = 1
326327
else

0 commit comments

Comments
 (0)