4747--- Check if the given path has no listed buffer
4848--- @param path string Absolute path
4949--- @param bufinfo table vim.fn.getbufinfo { buflisted = 1 }
50- --- @param unloaded_bufnr number optional bufnr recently unloaded via BufUnload event
5150--- @return boolean
52- local function buf (path , bufinfo , unloaded_bufnr )
51+ local function buf (path , bufinfo )
5352 if not M .config .filter_no_buffer or type (bufinfo ) ~= " table" then
5453 return false
5554 end
5655
5756 -- filter files with no open buffer and directories containing no open buffers
5857 for _ , b in ipairs (bufinfo ) do
59- if b .name == path or b .name :find (path .. " /" , 1 , true ) and b . bufnr ~= unloaded_bufnr then
58+ if b .name == path or b .name :find (path .. " /" , 1 , true ) then
6059 return false
6160 end
6261 end
@@ -105,16 +104,13 @@ end
105104
106105--- Prepare arguments for should_filter. This is done prior to should_filter for efficiency reasons.
107106--- @param git_status table | nil optional results of git.load_project_status (... )
108- --- @param unloaded_bufnr number | nil optional bufnr recently unloaded via BufUnload event
109107--- @return table
110108--- git_status: reference
111- --- unloaded_bufnr: copy
112109--- bufinfo: empty unless no_buffer set: vim.fn.getbufinfo { buflisted = 1 }
113110--- bookmarks: absolute paths to boolean
114- function M .prepare (git_status , unloaded_bufnr )
111+ function M .prepare (git_status )
115112 local status = {
116113 git_status = git_status or {},
117- unloaded_bufnr = unloaded_bufnr ,
118114 bufinfo = {},
119115 bookmarks = {},
120116 }
@@ -140,11 +136,7 @@ function M.should_filter(path, status)
140136 return false
141137 end
142138
143- return git (path , status .git_status )
144- or buf (path , status .bufinfo , status .unloaded_bufnr )
145- or dotfile (path )
146- or custom (path )
147- or bookmark (path , status .bookmarks )
139+ return git (path , status .git_status ) or buf (path , status .bufinfo ) or dotfile (path ) or custom (path ) or bookmark (path , status .bookmarks )
148140end
149141
150142function M .setup (opts )
0 commit comments