Skip to content

Commit

Permalink
fix(hyper): extract sep from mlist
Browse files Browse the repository at this point in the history
  • Loading branch information
adriankarlen committed Jun 22, 2024
1 parent 6fc2e0d commit 5990e85
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lua/dashboard/theme/hyper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,14 @@ local function mru_list(config)
local mlist = utils.get_mru_list()

if config.mru.cwd_only then
local cwd_filtered = uv.cwd():gsub('[\\/]', '')
local cwd = uv.cwd()
-- get separator from the first file
local sep = mlist[1]:match('[\\/]')
local cwd_with_sep = cwd:gsub('[\\/]', sep) .. sep
mlist = vim.tbl_filter(function(file)
local file_dir_filtered = vim.fn.fnamemodify(file, ':p:h'):gsub('[\\/]', '')
if file_dir_filtered and cwd_filtered then
return file_dir_filtered:sub(1, #cwd_filtered) == cwd_filtered
local file_dir = vim.fn.fnamemodify(file, ':p:h')
if file_dir and cwd_with_sep then
return file_dir:sub(1, #cwd_with_sep) == cwd_with_sep
end
end, mlist)
end
Expand Down

0 comments on commit 5990e85

Please sign in to comment.