feat: force buffer delete for terminal and improvements for Picker:delete_selection (#1943)

This commit is contained in:
TheMeaningfulEngineer
2022-05-29 19:54:31 +02:00
committed by Simon Hauser
parent 6dc0a7d7c2
commit a6c9ae088e
2 changed files with 8 additions and 4 deletions

View File

@@ -1020,7 +1020,9 @@ end
actions.delete_buffer = function(prompt_bufnr)
local current_picker = action_state.get_current_picker(prompt_bufnr)
current_picker:delete_selection(function(selection)
vim.api.nvim_buf_delete(selection.bufnr, { force = false })
local force = vim.api.nvim_buf_get_option(selection.bufnr, "buftype") == "terminal"
local ok = pcall(vim.api.nvim_buf_delete, selection.bufnr, { force = force })
return ok
end)
end