fix: bookmark filter should include parent directory (#2704)
* fix: bookmark filter should include parent directory * fix: dont match mark's siblings * fix: match mark from the start --------- Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
@@ -73,7 +73,20 @@ end
|
|||||||
---@param path string
|
---@param path string
|
||||||
---@param bookmarks table<string, boolean> absolute paths bookmarked
|
---@param bookmarks table<string, boolean> absolute paths bookmarked
|
||||||
local function bookmark(path, bookmarks)
|
local function bookmark(path, bookmarks)
|
||||||
return M.config.filter_no_bookmark and not bookmarks[path]
|
if not M.config.filter_no_bookmark then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add trailing slash to make it match only mark's parent directory
|
||||||
|
-- not it's siblings
|
||||||
|
local parent = utils.path_add_trailing(path)
|
||||||
|
for mark, _ in pairs(bookmarks) do
|
||||||
|
if path == mark or vim.fn.stridx(mark, parent) == 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param path string
|
---@param path string
|
||||||
|
|||||||
Reference in New Issue
Block a user