Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: utilize last window cursor position #2416

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lua/telescope/actions/set.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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`
Expand Down Expand Up @@ -169,6 +169,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
Expand Down