fix: telescope close process and cleanup layout actions (#1480)
This commit is contained in:
@@ -240,6 +240,7 @@ end
|
||||
actions._close = function(prompt_bufnr, keepinsert)
|
||||
action_state.get_current_history():reset()
|
||||
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||
local prompt_win = state.get_status(prompt_bufnr).prompt_win
|
||||
local original_win_id = picker.original_win_id
|
||||
|
||||
actions.close_pum(prompt_bufnr)
|
||||
@@ -247,7 +248,8 @@ actions._close = function(prompt_bufnr, keepinsert)
|
||||
vim.cmd [[stopinsert]]
|
||||
end
|
||||
|
||||
require("telescope.pickers").on_close_prompt(prompt_bufnr)
|
||||
vim.api.nvim_win_close(prompt_win, true)
|
||||
pcall(vim.cmd, string.format([[silent bdelete! %s]], prompt_bufnr))
|
||||
pcall(a.nvim_set_current_win, original_win_id)
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,13 @@ local action_state = require "telescope.actions.state"
|
||||
local state = require "telescope.state"
|
||||
local layout_strats = require "telescope.pickers.layout_strategies"
|
||||
|
||||
local action_layout = {}
|
||||
local transform_mod = require("telescope.actions.mt").transform_mod
|
||||
|
||||
local action_layout = setmetatable({}, {
|
||||
__index = function(_, k)
|
||||
error("'telescope.actions.layout' does not have a value: " .. tostring(k))
|
||||
end,
|
||||
})
|
||||
|
||||
--- Toggle preview window.
|
||||
--- - Note: preview window can be toggled even if preview is set to false.
|
||||
@@ -137,4 +143,5 @@ action_layout.cycle_layout_next = get_cycle_layout(1)
|
||||
---@param prompt_bufnr number: The prompt bufnr
|
||||
action_layout.cycle_layout_prev = get_cycle_layout(-1)
|
||||
|
||||
action_layout = transform_mod(action_layout)
|
||||
return action_layout
|
||||
|
||||
Reference in New Issue
Block a user