fix: history selector snacks.nvim live search error (#2870)
This commit is contained in:
@@ -8,10 +8,12 @@ function M.show(selector)
|
||||
Utils.error("Snacks is not set up. Please install and set up Snacks to use it as a file selector.")
|
||||
return
|
||||
end
|
||||
local function snacks_finder()
|
||||
local function snacks_finder(opts, ctx)
|
||||
local query = ctx.filter.search or ""
|
||||
local items = {}
|
||||
for i, item in ipairs(selector.items) do
|
||||
if not vim.list_contains(selector.selected_item_ids, item.id) then
|
||||
if query == "" or item.title:match(query:gsub("[%(%)%.%%%+%-%*%?%[%]%^%$]", "%%%1")) then
|
||||
table.insert(items, {
|
||||
formatted = item.title,
|
||||
text = item.title,
|
||||
@@ -27,6 +29,7 @@ function M.show(selector)
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
return items
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user