mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +00:00
fix(lsp): handle NUL bytes in popup text
Fix #25610
(cherry picked from commit 762a9e138b)
This commit is contained in:
committed by
github-actions[bot]
parent
47354c59bd
commit
9ee75f4781
@@ -1547,7 +1547,7 @@ function M._make_floating_popup_size(contents, opts)
|
||||
width = 0
|
||||
for i, line in ipairs(contents) do
|
||||
-- TODO(ashkan) use nvim_strdisplaywidth if/when that is introduced.
|
||||
line_widths[i] = vim.fn.strdisplaywidth(line)
|
||||
line_widths[i] = vim.fn.strdisplaywidth(line:gsub('%z', '\n'))
|
||||
width = math.max(line_widths[i], width)
|
||||
end
|
||||
end
|
||||
@@ -1576,7 +1576,7 @@ function M._make_floating_popup_size(contents, opts)
|
||||
height = 0
|
||||
if vim.tbl_isempty(line_widths) then
|
||||
for _, line in ipairs(contents) do
|
||||
local line_width = vim.fn.strdisplaywidth(line)
|
||||
local line_width = vim.fn.strdisplaywidth(line:gsub('%z', '\n'))
|
||||
height = height + math.ceil(line_width / wrap_at)
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user