From d2cca606a1b67a7e9e093154449f35eaacab0532 Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Sat, 22 Feb 2025 13:19:00 -0800 Subject: fix(float): ensure floating window width can fit title --- runtime/lua/vim/lsp/util.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/lua/vim/lsp/util.lua') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 9e84e27205..905b9822ba 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1417,6 +1417,11 @@ function M._make_floating_popup_size(contents, opts) -- make sure borders are always inside the screen width = math.min(width, screen_width - border_width) + -- Make sure that the width is large enough to fit the title. + if opts.title then + width = math.max(width, vim.fn.strdisplaywidth(opts.title)) + end + if wrap_at then wrap_at = math.min(wrap_at, width) end -- cgit