Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit ca5e534

Browse files
committed
fix: unavailable hover width(76)
1 parent 3ad9c31 commit ca5e534

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/completion/hover.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ local fancy_floating_markdown = function(contents, opts)
213213
})
214214
else
215215
local opt = make_floating_popup_options(width, height, opts)
216-
if opt.width < 0 then return end
216+
if opt.width <= 0 then return end
217217
winnr = api.nvim_open_win(bufnr, false, opt)
218218
end
219219
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, stripped)
@@ -280,7 +280,9 @@ local function callback_function(_, method, result)
280280
})
281281
M.winnr = winnr
282282

283-
vim.lsp.util.close_preview_autocmd({"CursorMoved", "BufHidden", "InsertCharPre"}, winnr)
283+
if winnr ~= nil and api.nvim_win_is_valid(winnr) then
284+
vim.lsp.util.close_preview_autocmd({"CursorMoved", "BufHidden", "InsertCharPre"}, winnr)
285+
end
284286
local hover_len = #vim.api.nvim_buf_get_lines(bufnr,0,-1,false)[1]
285287
local win_width = vim.api.nvim_win_get_width(0)
286288
if hover_len > win_width then

0 commit comments

Comments
 (0)