This reverts commit 3f1b57908b.
This commit is contained in:
@@ -353,8 +353,17 @@ end
|
|||||||
--- Close the Telescope window, usually used within an action
|
--- Close the Telescope window, usually used within an action
|
||||||
---@param prompt_bufnr number: The prompt bufnr
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
actions.close = function(prompt_bufnr)
|
actions.close = function(prompt_bufnr)
|
||||||
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
|
local original_win_id = picker.original_win_id
|
||||||
|
local cursor_valid, original_cursor = pcall(a.nvim_win_get_cursor, original_win_id)
|
||||||
|
|
||||||
actions.close_pum(prompt_bufnr)
|
actions.close_pum(prompt_bufnr)
|
||||||
|
|
||||||
require("telescope.pickers").on_close_prompt(prompt_bufnr)
|
require("telescope.pickers").on_close_prompt(prompt_bufnr)
|
||||||
|
pcall(a.nvim_set_current_win, original_win_id)
|
||||||
|
if cursor_valid and a.nvim_get_mode().mode == "i" and picker._original_mode ~= "i" then
|
||||||
|
pcall(a.nvim_win_set_cursor, original_win_id, { original_cursor[1], original_cursor[2] + 1 })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Close the Telescope window, usually used within an action<br>
|
--- Close the Telescope window, usually used within an action<br>
|
||||||
|
|||||||
@@ -1497,12 +1497,7 @@ function pickers.on_close_prompt(prompt_bufnr)
|
|||||||
event = "BufLeave",
|
event = "BufLeave",
|
||||||
buffer = prompt_bufnr,
|
buffer = prompt_bufnr,
|
||||||
}
|
}
|
||||||
|
picker.close_windows(status)
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<esc>", true, true, true), "n", true)
|
|
||||||
vim.defer_fn(function()
|
|
||||||
picker.close_windows(status)
|
|
||||||
end, 0)
|
|
||||||
|
|
||||||
mappings.clear(prompt_bufnr)
|
mappings.clear(prompt_bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user