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()
195
195
end
196
196
197
197
--- @param bufnr integer
198
+ --- @param ignore ? vcs.File[]
198
199
--- @return boolean
199
- function M .is_buf_in_use (bufnr )
200
+ function M .is_buf_in_use (bufnr , ignore )
200
201
for _ , view in ipairs (M .views ) do
201
202
if view :instanceof (StandardView .__get ()) then
202
203
--- @cast view StandardView
203
204
for _ , file in ipairs (view .cur_entry and view .cur_entry .layout :files () or {}) do
204
205
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
206
209
end
207
210
end
208
211
end
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ function File:destroy(force)
108
108
self .active = false
109
109
self :detach_buffer ()
110
110
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
112
112
File .safe_delete_buf (self .bufnr )
113
113
end
114
114
end
@@ -368,7 +368,7 @@ function File:dispose_buffer()
368
368
if self .bufnr and api .nvim_buf_is_loaded (self .bufnr ) then
369
369
self :detach_buffer ()
370
370
371
- if not lib .is_buf_in_use (self .bufnr ) then
371
+ if not lib .is_buf_in_use (self .bufnr , { self } ) then
372
372
File .safe_delete_buf (self .bufnr )
373
373
end
374
374
You can’t perform that action at this time.
0 commit comments