From f10a18edda17658e8372730f4fa9e887f10778b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Karl=C3=A9n?= <113891532+adriankarlen@users.noreply.github.com> Date: Sun, 23 Jun 2024 03:51:48 +0200 Subject: [PATCH] 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 --- lua/dashboard/theme/hyper.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/dashboard/theme/hyper.lua b/lua/dashboard/theme/hyper.lua index 3f99f22..4e09fae 100644 --- a/lua/dashboard/theme/hyper.lua +++ b/lua/dashboard/theme/hyper.lua @@ -175,11 +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 + -- 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 = vim.fn.fnamemodify(file, ':p:h') .. sep - if file_dir and cwd then + 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)