mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
This commit is contained in:
parent
c5257fa690
commit
4438ee4770
1 changed files with 4 additions and 7 deletions
|
|
@ -314,11 +314,10 @@ end
|
|||
---@param line snacks.picker.Highlight[]
|
||||
---@param max_width number
|
||||
function M.resolve(line, max_width)
|
||||
local offset = 0
|
||||
local width = 0
|
||||
local resolve ---@type number?
|
||||
|
||||
while true do
|
||||
local offset = 0
|
||||
local width = 0
|
||||
local resolve ---@type number?
|
||||
for t, text in ipairs(line) do
|
||||
local w = M.offset({ text }, { char_idx = true })
|
||||
if not resolve and type(text) == "table" and text.resolve then
|
||||
|
|
@ -336,13 +335,11 @@ function M.resolve(line, max_width)
|
|||
local ret = {} ---@type snacks.picker.Highlight[]
|
||||
vim.list_extend(ret, line, 1, resolve - 1)
|
||||
offset = M.offset(ret)
|
||||
vim.list_extend(ret, line[resolve].resolve(max_width - width))
|
||||
vim.list_extend(ret, line[resolve].resolve(math.max(max_width - width, 1)))
|
||||
local diff = M.offset(ret) - offset
|
||||
vim.list_extend(ret, line, resolve + 1)
|
||||
M.fix_offset(ret, diff, resolve + 1)
|
||||
line = ret
|
||||
ret = {}
|
||||
resolve = nil
|
||||
else
|
||||
return line
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue