From e5d98d85693245fec811307e5a2ccfdea3a350cd Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 30 Sep 2020 18:03:40 +0200 Subject: LSP: Fix separator width on hover (fixes #13006, #12998) (#13007) * fix insert_separator conditional * only draw separator over wrapped width --- runtime/lua/vim/lsp/util.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index d94a8bb774..53f88dea7d 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -800,13 +800,14 @@ function M.fancy_floating_markdown(contents, opts) local width, height = M._make_floating_popup_size(stripped, opts) -- Insert blank line separator after code block - local insert_separator = opts.separator or true + local insert_separator = opts.separator + if insert_separator == nil then insert_separator = true end if insert_separator then for i, h in ipairs(highlights) do h.start = h.start + i - 1 h.finish = h.finish + i - 1 if h.finish + 1 <= #stripped then - table.insert(stripped, h.finish + 1, string.rep("─", width)) + table.insert(stripped, h.finish + 1, string.rep("─", math.min(width, opts.wrap_at))) height = height + 1 end end -- cgit