-
Notifications
You must be signed in to change notification settings - Fork 251
fix(winfixbuf): avoid windows that have winfixbuf
when opening buffers
#1390
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(winfixbuf): avoid windows that have winfixbuf
when opening buffers
#1390
Conversation
Wait a second. |
It was quite complicated... If you do
we have two windows and two buffers.
Now try to open a So we need to open a new split just like when neo-tree is the single window.
Here comes the difficult part. Run
The story doesn't end here. Run
This is the reason why I had to wait for |
At first glance, you might think why not If we set winfixbuf for neo-tree windows, things such as Then now you might wonder, why not open a new dedicated window for each source and close the previous one? |
I don't consider that a valid situation that we should have code to cover. It's not reasonable for a file that someone would open from neo-tree has Also, the tests are failing so there's still more work to do here. |
I doubt that. I will want to occasionally reference a single file while editing multiple files, and manually triggering
This is more of an existing issue. You can replicate this by
The expected behavior is 1) neo-tree closes, 2) a new window with file-B opens next to file-A. |
In order to avoid this issue, we need to basically wait one more event loop. Therefore, Running a short I'll push these changes as well. |
That makes no sense, you are abusing the new feature which is meant for tool windows. If you don't want to open a new file in the window with defaults.lua, just do whatever you do now to make that happen. I'm going to rant for a second here. This is part of the reason why I'm on the edge of leaving the project. People have so many bad ideas predicated on unnaturally forcing nvim to be vs code when there are much simpler ways of doing things. If you are going to use splits and want to control which windows something opens in, then go to/create the window you want to use first, then use Yes we should avoid opening in winfixbuf windows rather than cause an error. No we should not add extra code to ensure it focuses a window that is obviously already open if someone tries to open a file that is already visible and that file happens to have been set with winfixbuf. That's just ridiculous.
I don't quite get that,
That's good. I know the tests are flaky and if a simple wait is all that's needed then that's awesome. |
I absolutely agree with this lol We should make
My story was basically explaining why it took so long to get the final version from the first iteration. I haven't explained above but since user can also call Actually open a file that is already visible in winfixbuf succeeds first, and then the normal operation will happen after initial try fails. So that feature is actually a by-product that just happens. It'll be more difficult to prevent that.
!Don't close this was just a comment, meaning to literally press record.mp4Lazy won't close automatically so there's a difference, but you can see that the new buffer should be created as a new split in the background. |
Regarding the floating neo-tree -> vsplit command issue, that seems like more of a neovim glitch to me, I'm not sure how we are affecting that behavior. We do automatically close the window when it loses focus so that must be related. Either way it's another silly thing to do so I wouldn't personally give it a second thought one way or another. |
Please test this branch. The issue should be fixed with this PR. |
Somehow this commit has caused a bug with
Error from step 5:
@pysan3 I'm not sure I am going to be able to debug so I was thinking about reverting it for now. Do you want to look into it before I do? |
I don't see this error with nvim-nightly in the first place so there must be an issue (or I used a nightly only feature again) with nvim-stable. Plz wait for one hour and I'll report you back. |
@cseickel Found the bug. |
Could you also check if it's working before merging the PR? @cseickel |
Ref: neovim/neovim#12517
First challenge to workaround new
winfixbuf
option added to nvim-nightly.Please read the long discussion about this new feature here: vim/vim#13903.