-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
fix: don't reference unloaded buffers #928
fix: don't reference unloaded buffers #928
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, happy to give this a shot
I just updated my plugins, and this commit causes bufferline to stop working with possession. With this commit, only the last used tab gets loaded. |
I use different session plugin and have same issue. |
Sigh 😔 well worth a shot will revert for now, too many obscure requirements to get this working |
…)" This reverts commit 6ac7e4f.
Rolling back is the right call for now. Clearly this PR causes some unexpected side effects for session plugin users. I am happy to install possession and see if I can further root cause the issue. My initial hunch is that these plugins must intentionally utilize unloaded buffers in a way that I didn't initially anticipate. |
Someone suggested swapping the order of the |
Unfortunately that solution does not resolve the I have opened a new PR which I believe contains a working solution. That is— it resolves the |
Problem: Currently when checking if a buffer is valid, we use the function nvim_buf_is_valid, however there is an edge case here described in the documentation where a buffer could have been unloaded, but still be "valid". If a buffer is unloaded and valid then referencing buflisted will result in a (UNKNOWN PLUGIN): Error executing lua: attempt to call a number value error. Solution: Instead of nvim_buf_is_valid we use nvim_buf_is_loaded which checks both whether a buffer is valid and loaded. This way we never attempt to reference buflisted of unloaded or invalid buffers. This PR should at least partially address akinsho#869. Applying the patch removes these errors for my config when invoking Neovim via nvim .. Because this error is so generic, it's possible that there could be more than one cause.
* Revert "fix: UNKNOWN PLUGIN error resulting from unloaded buffers (akinsho#928)" This reverts commit 6ac7e4f. * refactor: check exists before listed
Problem
Currently when checking if a buffer is valid, we use the function nvim_buf_is_valid, however there is an edge case here described in the documentation where a buffer could have been unloaded, but still be "valid". If a buffer is unloaded and valid then referencing
buflisted
will result in a(UNKNOWN PLUGIN): Error executing lua: attempt to call a number value
error.Solution
Instead of
nvim_buf_is_valid
we use nvim_buf_is_loaded which checks both whether a buffer is valid and loaded. This way we never attempt to referencebuflisted
of unloaded or invalid buffers.This PR should at least partially address #869. Applying the patch removes these errors for my config when invoking Neovim via
nvim .
. Because this error is so generic, it's possible that there could be more than one cause.