This reverts commit 01426c491b.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
local a = vim.api
|
||||
|
||||
local log = require "telescope.log"
|
||||
local Path = require "plenary.path"
|
||||
local state = require "telescope.state"
|
||||
|
||||
@@ -128,22 +129,19 @@ action_set.edit = function(prompt_bufnr, command)
|
||||
vim.api.nvim_buf_set_option(entry_bufnr, "buflisted", true)
|
||||
end
|
||||
edit_buffer(command, entry_bufnr)
|
||||
require("telescope.actions.utils").__jump_to(row, col)
|
||||
else
|
||||
-- check if we didn't pick a different buffer
|
||||
-- prevents restarting lsp server
|
||||
if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then
|
||||
filename = Path:new(vim.fn.fnameescape(filename)):normalize(vim.loop.cwd())
|
||||
-- Make sure we wait till we are back in insert mode before opening the file
|
||||
-- This fixes foldes
|
||||
vim.cmd(string.format(
|
||||
[[%s :lua require("telescope.actions.utils").__open_file_at("%s", "%s", %s, %s)]],
|
||||
"autocmd InsertLeave * ++once ++nested", -- open file as soon as we have left insert mode (fixes folding)
|
||||
command,
|
||||
filename,
|
||||
row,
|
||||
col
|
||||
))
|
||||
pcall(vim.cmd, string.format("%s %s", command, filename))
|
||||
end
|
||||
end
|
||||
|
||||
if row and col then
|
||||
local ok, err_msg = pcall(a.nvim_win_set_cursor, 0, { row, col })
|
||||
if not ok then
|
||||
log.debug("Failed to move to cursor:", err_msg, row, col)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user