mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
fix(dashboard): prevent possible duplicate recent files. Fixes #171
This commit is contained in:
parent
9ef424bf79
commit
93b254d658
1 changed files with 3 additions and 1 deletions
|
@ -769,9 +769,11 @@ function M.sections.recent_files(opts)
|
|||
local limit = opts.limit or 5
|
||||
local root = opts.cwd and vim.fs.normalize(opts.cwd == true and vim.fn.getcwd() or opts.cwd) or ""
|
||||
local ret = {} ---@type snacks.dashboard.Section
|
||||
local done = {} ---@type table<string, boolean>
|
||||
for _, file in ipairs(vim.v.oldfiles) do
|
||||
file = vim.fs.normalize(file, { _fast = true, expand_env = false })
|
||||
if file:sub(1, #root) == root and uv.fs_stat(file) then
|
||||
if not done[file] and file:sub(1, #root) == root and uv.fs_stat(file) then
|
||||
done[file] = true
|
||||
ret[#ret + 1] = {
|
||||
file = file,
|
||||
icon = "file",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue