You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ALL): handle :%bdelete if a module has persistent scratch buffer
Details:
- For either performance or user convenience (less increasing of buffer
ids), some modules create a helper scratch buffer once and reuse it
whenever it is needed. Like 'mini.clue' and 'mini.notify' use one
buffer to show its content. Or like 'mini.icons' and 'mini.notify'
have specific buffers to enable certain kind of behavior.
Those need to be handled (re-created and re-cached) if the user
deletes all buffers. This was previously handled for `:%bwipeout`
case, but not for `:%bdelete`. The difference is that `:bdelete` only
unloads all buffers without actually deleting them. Among other
things, this means that all their options are removed. In particular
'buftype' option is reset making those buffers regular and not scratch
(`buftype=nofile`) yet still unlisted ("invisible" to the user).
This can have problematic side effects. Like if the intended scratch
buffer is used to show text, it will become modified which has
negative user effects (like `:quit` doesn't work since there are
modified buffers).
- A solution is to handle buffer deletion not by checking with
`nvim_buf_is_valid()`, but by a combination of `nvim_buf_is_loaded()`
check and `pcall(nvim_buf_delete, buf_id, { force = true })` cleanup
if the buffer is not loaded.
Resolve#2365
0 commit comments