File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -195,14 +195,17 @@ function M.get_prev_non_view_tabpage()
195195end
196196
197197--- @param bufnr integer
198+ --- @param ignore ? vcs.File[]
198199--- @return boolean
199- function M .is_buf_in_use (bufnr )
200+ function M .is_buf_in_use (bufnr , ignore )
200201 for _ , view in ipairs (M .views ) do
201202 if view :instanceof (StandardView .__get ()) then
202203 --- @cast view StandardView
203204 for _ , file in ipairs (view .cur_entry and view .cur_entry .layout :files () or {}) do
204205 if file :is_valid () and file .bufnr == bufnr then
205- return true
206+ if not (ignore and vim .tbl_contains (ignore , file )) then
207+ return true
208+ end
206209 end
207210 end
208211 end
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ function File:destroy(force)
108108 self .active = false
109109 self :detach_buffer ()
110110
111- if force or self .rev .type ~= RevType .LOCAL and not lib .is_buf_in_use (self .bufnr ) then
111+ if force or self .rev .type ~= RevType .LOCAL and not lib .is_buf_in_use (self .bufnr , { self } ) then
112112 File .safe_delete_buf (self .bufnr )
113113 end
114114end
@@ -368,7 +368,7 @@ function File:dispose_buffer()
368368 if self .bufnr and api .nvim_buf_is_loaded (self .bufnr ) then
369369 self :detach_buffer ()
370370
371- if not lib .is_buf_in_use (self .bufnr ) then
371+ if not lib .is_buf_in_use (self .bufnr , { self } ) then
372372 File .safe_delete_buf (self .bufnr )
373373 end
374374
You can’t perform that action at this time.
0 commit comments