fix: selector item title cannot contains newline (#1978)

This commit is contained in:
yetone
2025-05-03 14:45:06 +08:00
committed by GitHub
parent e3af524bc1
commit fcf6e8617e

View File

@@ -32,7 +32,14 @@ function Selector:new(opts)
setmetatable(o, Selector)
o.provider = opts.provider
o.title = opts.title
o.items = opts.items
o.items = vim
.iter(opts.items)
:map(function(item)
local new_item = vim.deepcopy(item)
new_item.title = new_item.title:gsub("\n", " ")
return new_item
end)
:totable()
o.default_item_id = opts.default_item_id
o.provider_opts = opts.provider_opts or {}
o.on_select = opts.on_select