mirror of
https://github.com/zoriya/telescope.nvim.git
synced 2026-06-05 11:59:42 +00:00
feat: utilize last window cursor position (#2416)
closes #2386
(cherry picked from commit 98f9d5f948)
This commit is contained in:
@@ -104,7 +104,7 @@ action_set.edit = function(prompt_bufnr, command)
|
||||
|
||||
-- TODO: Check for off-by-one
|
||||
row = entry.row or entry.lnum
|
||||
col = vim.F.if_nil(entry.col, 1)
|
||||
col = entry.col
|
||||
elseif not entry.bufnr then
|
||||
-- TODO: Might want to remove this and force people
|
||||
-- to put stuff into `filename`
|
||||
@@ -163,6 +163,11 @@ action_set.edit = function(prompt_bufnr, command)
|
||||
end
|
||||
end
|
||||
|
||||
if row == nil or col == nil then
|
||||
local pos = vim.api.nvim_win_get_cursor(0)
|
||||
row, col = pos[1], pos[2] + 1
|
||||
end
|
||||
|
||||
if row and col then
|
||||
local ok, err_msg = pcall(a.nvim_win_set_cursor, 0, { row, col })
|
||||
if not ok then
|
||||
|
||||
Reference in New Issue
Block a user