fix(picker.util): proper cwd check for paths. Fixes #754. See #757

This commit is contained in:
Folke Lemaitre 2025-01-28 13:20:53 +01:00
parent ea44a2d4c2
commit 1069d78334
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -22,7 +22,7 @@ function M.truncpath(path, len, opts)
local home = vim.fs.normalize("~")
path = vim.fs.normalize(path, { _fast = true, expand_env = false })
if path:find(cwd, 1, true) == 1 and #path > #cwd then
if path:find(cwd .. "/", 1, true) == 1 and #path > #cwd then
path = path:sub(#cwd + 2)
else
local root = Snacks.git.get_root(path)