aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorXuyuan Pang <xuyuanp@gmail.com>2025-01-14 07:17:23 +0800
committerGitHub <noreply@github.com>2025-01-13 15:17:23 -0800
commita4f575abd85e734340ee303daace1a63e5ca9782 (patch)
treeb7c7ad331089a39fe14dea29107dd58b354f169b /runtime/lua/vim/lsp/util.lua
parent34e2185022ab698827b72751d77e218a1b6b6afe (diff)
downloadrneovim-a4f575abd85e734340ee303daace1a63e5ca9782.tar.gz
rneovim-a4f575abd85e734340ee303daace1a63e5ca9782.tar.bz2
rneovim-a4f575abd85e734340ee303daace1a63e5ca9782.zip
fix(lsp): minimum height for floating popup #31990
Problem: The floating window for hover and signature help always cuts off a few lines, because the `_make_floating_popup_size` function counts empty lines as having zero height. Solution: Ensure the height is at least 1.
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index ccd68f0fdf..14633adf0c 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -1432,7 +1432,7 @@ function M._make_floating_popup_size(contents, opts)
if vim.tbl_isempty(line_widths) then
for _, line in ipairs(contents) do
local line_width = vim.fn.strdisplaywidth(line:gsub('%z', '\n'))
- height = height + math.ceil(line_width / wrap_at)
+ height = height + math.max(1, math.ceil(line_width / wrap_at))
end
else
for i = 1, #contents do