Skip to content

Commit

Permalink
fix: accurately identify files within current working directory for M…
Browse files Browse the repository at this point in the history
…RU filtering (#459)

* Fix MRU Filtering Logic to Accurately Identify Files within CWD

* use `is_win`

* fix
  • Loading branch information
izumin5210 authored Jun 2, 2024
1 parent b5a2a42 commit ae05b8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/dashboard/theme/hyper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,12 @@ local function mru_list(config)

if config.mru.cwd_only then
local cwd = uv.cwd()
local sep = utils.is_win and '\\' or '/'
local cwd_with_sep = cwd .. sep
mlist = vim.tbl_filter(function(file)
local file_dir = vim.fn.fnamemodify(file, ':p:h')
local file_dir = vim.fn.fnamemodify(file, ':p:h') .. sep
if file_dir and cwd then
return file_dir:find(cwd, 1, true) == 1
return file_dir:sub(1, #cwd_with_sep) == cwd_with_sep
end
end, mlist)
end
Expand Down

0 comments on commit ae05b8c

Please sign in to comment.