Skip to content

Commit ae05b8c

Browse files
authored
fix: accurately identify files within current working directory for MRU filtering (#459)
* Fix MRU Filtering Logic to Accurately Identify Files within CWD * use `is_win` * fix
1 parent b5a2a42 commit ae05b8c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/dashboard/theme/hyper.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,12 @@ local function mru_list(config)
175175

176176
if config.mru.cwd_only then
177177
local cwd = uv.cwd()
178+
local sep = utils.is_win and '\\' or '/'
179+
local cwd_with_sep = cwd .. sep
178180
mlist = vim.tbl_filter(function(file)
179-
local file_dir = vim.fn.fnamemodify(file, ':p:h')
181+
local file_dir = vim.fn.fnamemodify(file, ':p:h') .. sep
180182
if file_dir and cwd then
181-
return file_dir:find(cwd, 1, true) == 1
183+
return file_dir:sub(1, #cwd_with_sep) == cwd_with_sep
182184
end
183185
end, mlist)
184186
end

0 commit comments

Comments
 (0)