fix(picker.format): extra slash in path

This commit is contained in:
Folke Lemaitre 2025-01-31 17:09:05 +01:00
parent 16d700eb65
commit dad3e00e83
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 1 additions and 3 deletions

View file

@ -57,9 +57,6 @@ function M.filename(item, picker)
path = vim.fn.fnamemodify(item.file, ":t")
ret[#ret + 1] = { path, base_hl, field = "file" }
else
if item.dir then
path = path .. "/"
end
local dir, base = path:match("^(.*)/(.+)$")
if base and dir then
if picker.opts.formatters.file.filename_first then

View file

@ -33,6 +33,7 @@ function M.truncpath(path, len, opts)
path = "~" .. path:sub(#home + 1)
end
end
path = path:gsub("/$", "")
if vim.api.nvim_strwidth(path) <= len then
return path