feat: force buffer delete for terminal and improvements for Picker:delete_selection (#1943)
This commit is contained in:
committed by
Simon Hauser
parent
6dc0a7d7c2
commit
a6c9ae088e
@@ -693,7 +693,7 @@ end
|
||||
---
|
||||
--- Example usage in telescope:
|
||||
--- - `actions.delete_buffer()`
|
||||
---@param delete_cb function: called with each deleted selection
|
||||
---@param delete_cb function: called for each selection fn(s) -> bool|nil (true|nil removes the entry from the results)
|
||||
function Picker:delete_selection(delete_cb)
|
||||
vim.validate { delete_cb = { delete_cb, "f" } }
|
||||
local original_selection_strategy = self.selection_strategy
|
||||
@@ -719,8 +719,10 @@ function Picker:delete_selection(delete_cb)
|
||||
return x > y
|
||||
end)
|
||||
for _, index in ipairs(selection_index) do
|
||||
local selection = table.remove(self.finder.results, index)
|
||||
delete_cb(selection)
|
||||
local delete_cb_return = delete_cb(self.finder.results[index])
|
||||
if delete_cb_return == nil or delete_cb_return == true then
|
||||
table.remove(self.finder.results, index)
|
||||
end
|
||||
end
|
||||
|
||||
if used_multi_select then
|
||||
|
||||
Reference in New Issue
Block a user