fix: exiting picker from insert mode (#1202)
This commit is contained in:
@@ -343,14 +343,17 @@ end
|
||||
--- Close the Telescope window, usually used within an action
|
||||
---@param prompt_bufnr number: The prompt bufnr
|
||||
actions.close = function(prompt_bufnr)
|
||||
action_state.get_current_history():reset()
|
||||
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||
local original_win_id = picker.original_win_id
|
||||
local original_cursor = a.nvim_win_get_cursor(original_win_id)
|
||||
|
||||
actions.close_pum(prompt_bufnr)
|
||||
|
||||
require("telescope.pickers").on_close_prompt(prompt_bufnr)
|
||||
pcall(a.nvim_set_current_win, original_win_id)
|
||||
if a.nvim_get_mode().mode == "i" then
|
||||
pcall(a.nvim_win_set_cursor, original_win_id, { original_cursor[1], original_cursor[2] + 1 })
|
||||
end
|
||||
end
|
||||
|
||||
--- Close the Telescope window, usually used within an action<br>
|
||||
|
||||
@@ -131,7 +131,7 @@ action_set.edit = function(prompt_bufnr, command)
|
||||
local entry_bufnr = entry.bufnr
|
||||
|
||||
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||
require("telescope.actions").close(prompt_bufnr)
|
||||
require("telescope.pickers").on_close_prompt(prompt_bufnr)
|
||||
local win_id = picker.get_selection_window(picker, entry)
|
||||
|
||||
if picker.push_cursor_on_edit then
|
||||
|
||||
Reference in New Issue
Block a user