Repository navigation
fix: load directory buffers created with bufadd() after setup - #795
Open
MaxWang007 wants to merge 1 commit into
Open
MaxWang007 wants to merge 1 commit into
MaxWang007 wants to merge 1 commit into
Conversation
bufadd() does not list the buffer, so Oil's BufAdd autocmd never runs and nvim_set_current_buf() shows a blank directory. Listing that loaded buffer later renames it to oil:// without reading it. Hijack unlisted directory buffers created after setup, and load a directory buffer that is already loaded when it is hijacked. Fixes stevearc#782 Co-authored-by: MaxWang007 <MaxWang007@users.noreply.github.com>
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.
Fixes #782
vim.fn.bufadd()creates an unlisted buffer, so onlyBufNewfires, notBufAdd. Oil only hijacked directories onBufAdd, which leftnvim_set_current_buf()showing a blank directory buffer.If that already-loaded buffer was later listed, it got renamed to
oil://…butBufReadCmddid not run, so the listing stayed empty. That's the same gapSessionLoadPostalready covers withload_oil_buffer().This change hijacks unlisted directory buffers created after
setup(), and callsload_oil_buffer()when a hijacked buffer is already loaded. Directory buffers that existed beforesetup()are left to #792../run_tests.shon Neovim v0.12.6: 110 passed, including 2 new regressions that fail on current master. StyLua and luacheck passed on the touched files. AI was used to help implement this.