Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/govim: delete internal buffers on BufWipeout autocommands #1033

Closed
leitzler opened this issue Feb 4, 2021 · 1 comment · Fixed by #1037
Closed

cmd/govim: delete internal buffers on BufWipeout autocommands #1033

leitzler opened this issue Feb 4, 2021 · 1 comment · Fixed by #1037
Assignees

Comments

@leitzler
Copy link
Member

leitzler commented Feb 4, 2021

What version/commit of govim are you using?

Current main, 9b702de

Currently we are listening for BufDelete and clean up our internal state when we get it, but the help file states that we won't get it for buffers that is deleted and not loaded:

Before deleting a buffer from the buffer list.
The BufUnload may be called first (if the
buffer was loaded).
Also used just before a buffer in the buffer
list is renamed.

We should do the same thing when we get a BufWipeout autocommand to make sure we don't keep things in memory that aren't in vim anymore. From BufWipeout:

Before completely deleting a buffer. The
BufUnload and BufDelete events may be called
first (if the buffer was loaded and was in the
buffer list). Also used just before a buffer
is renamed (also when it's not in the buffer
list).

@myitcv
Copy link
Member

myitcv commented Feb 5, 2021

The dreaded Vim buffer state lifecycle strikes again :)

leitzler added a commit that referenced this issue Feb 8, 2021
There are cases where we might get a BufWipeout autocmd without the
BufDelete (most notably when running :vimgrep). When that happen we kept
the internal buffer in govim even if we had no use of it anymore.

When using :bwipe we do get both BufDelete and BufWipeout, but as far as
we know BufDelete will always appear before BufWipeout. Trying to remove
an internal buffer due to BufWipeout will not cause an error.

Fixes #1033
leitzler added a commit that referenced this issue Feb 9, 2021
There are cases where we might get a BufWipeout autocmd without the
BufDelete (most notably when running :vimgrep). When that happen we kept
the internal buffer in govim even if we had no use of it anymore.

When using :bwipe we do get both BufDelete and BufWipeout, but as far as
we know BufDelete will always appear before BufWipeout. Trying to remove
an internal buffer due to BufWipeout will not cause an error.

Fixes #1033
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants