mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(picker.git_diff): use absolute path when adding buffer to avoid duplicates (#1819)
## Description Uses absolute path for setting the cursor <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Related Issue(s) Fixes #1818 <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots <!-- Add screenshots of the changes if applicable. --> --------- Co-authored-by: Aaron Weisberg <aaron.weisberg@quizlet.com>
This commit is contained in:
parent
259cb01d7d
commit
a012f394c9
1 changed files with 6 additions and 1 deletions
|
|
@ -216,9 +216,13 @@ function M.diff(opts, ctx)
|
|||
local file, line ---@type string?, number?
|
||||
local header, hunk = {}, {} ---@type string[], string[]
|
||||
local header_len = 4
|
||||
|
||||
local cwd = svim.fs.normalize(opts and opts.cwd or uv.cwd() or ".") or nil
|
||||
cwd = Snacks.git.get_root(cwd) or cwd
|
||||
|
||||
local finder = require("snacks.picker.source.proc").proc({
|
||||
opts,
|
||||
{ cmd = "git", args = args },
|
||||
{ cmd = "git", args = args, cwd = cwd },
|
||||
}, ctx)
|
||||
return function(cb)
|
||||
local function add()
|
||||
|
|
@ -228,6 +232,7 @@ function M.diff(opts, ctx)
|
|||
text = file .. ":" .. line,
|
||||
diff = diff,
|
||||
file = file,
|
||||
cwd = cwd,
|
||||
pos = { line, 0 },
|
||||
preview = { text = diff, ft = "diff", loc = false },
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue