fix(dashboard): guard augroup deletion on buffer wipeout - #2917
Open
joshmedeski wants to merge 1 commit into
Open
fix(dashboard): guard augroup deletion on buffer wipeout#2917joshmedeski wants to merge 1 commit into
joshmedeski wants to merge 1 commit into
Conversation
All dashboard instances share one fixed augroup name ("snacks_dashboard"),
so they resolve to the same augroup id. Each dashboard buffer installs its
own buffer-local BufWipeout/BufDelete autocmd that unconditionally calls
nvim_del_augroup_by_id(self.augroup). With more than one dashboard buffer
alive, the second one wiped deletes an already-deleted augroup and throws
E367: No such group: "--Deleted--".
pcall the deletion and clear self.augroup afterwards, matching the pattern
already used in win.lua, image/placement.lua and explorer/init.lua.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
All dashboard instances share a single fixed augroup name (
"snacks_dashboard"), so they resolve to the same augroup id. Each dashboard buffer, however, installs its own buffer-localBufWipeout/BufDeleteautocmd that unconditionally callsnvim_del_augroup_by_id(self.augroup):When more than one dashboard buffer is alive at once, the first buffer wiped deletes the shared augroup, and the second buffer wiped tries to delete the same (now-deleted) id, throwing:
This happens whenever the dashboard is opened more than once in a session (e.g. startup dashboard + reopening it, or configs that reopen the dashboard when the last buffer is closed) and the buffers are later wiped, such as when opening a file from a picker.
This PR wraps the deletion in
pcalland clearsself.augroupafterwards, matching the pattern already used elsewhere in the codebase (win.lua,image/placement.lua,explorer/init.lua).Reproduction
Before: the second delete throws
E367. After: both deletes succeed.Related Issue(s)