Skip to content

Commit f10a18e

Browse files
authored
fix(hyper): handle backslash and slash regardles of os in cwd (#463)
* fix(hyper): use backslash when user has shellslash enabled on windows * fix: test wit use explicitly * fix: handle backslash and slash regardless of os * fix(hyper): use correct matching method * fix(hyper): extract sep from mlist
1 parent b88c997 commit f10a18e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lua/dashboard/theme/hyper.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +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
178+
-- get separator from the first file
179+
local sep = mlist[1]:match('[\\/]')
180+
local cwd_with_sep = cwd:gsub('[\\/]', sep) .. sep
180181
mlist = vim.tbl_filter(function(file)
181-
local file_dir = vim.fn.fnamemodify(file, ':p:h') .. sep
182-
if file_dir and cwd then
182+
local file_dir = vim.fn.fnamemodify(file, ':p:h')
183+
if file_dir and cwd_with_sep then
183184
return file_dir:sub(1, #cwd_with_sep) == cwd_with_sep
184185
end
185186
end, mlist)

0 commit comments

Comments
 (0)