fix: fix wrong display size caculate remove util.display_size func

This commit is contained in:
JuanZoran
2023-03-24 00:10:14 +08:00
parent b44ab4bf2e
commit 9f5a81249c
2 changed files with 33 additions and 42 deletions

View File

@ -103,20 +103,6 @@ function M.display_width(lines)
return width
end
---Calculates the height and width of the text to be displayed
---@param lines string[] text to be displayed
---@param width integer width of the window
---@return { height: integer, width: integer } _ display height and width
function M.display_size(lines, width)
local ds_height, ds_width = 0, 0
for _, line in ipairs(lines) do
local wid = line:width()
ds_height = ds_height + math.max(1, (math.ceil(wid / width)))
ds_width = math.max(wid, ds_width)
end
return { height = ds_height, width = ds_width }
end
---Center node utility function
---@param node string -- TODO :Node