-
Notifications
You must be signed in to change notification settings - Fork 130
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: set alternate when using floating windows (#285) #526
Conversation
Everything related to the alternate buffer is very tricky. Please add at least one test to cover this case in https://github.com/stevearc/oil.nvim/blob/master/tests/altbuf_spec.lua. Make sure that it fails without your change applied and passes with it. |
I completely missed the tests, my bad. I'll give it a go tonight! |
cbb4dd1
to
f6314c6
Compare
Done, sorry for missing the tests! I confirmed the new test fails in master but passes on my branch. |
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 for adding the test! I fiddled with it a bit on my end, and I think that a simpler fix is to remove the keepalt = true
on this line.
Line 721 in 7a55ede
keepalt = true, |
That handles the float win case for me, and doesn't seem to impact any of the other tests.
f6314c6
to
bbb102f
Compare
You're right, I can confirm it works on my end and it looks like a much more appropriate fix. I just sent the revised code! |
Something strange going on with the test failures in 0.8. I'll investigate when I get a chance |
bbb102f
to
7c1f27b
Compare
I think I found the issue in v0.8, when I removed -- lua/oil/init.lua:717
local mods = {
vertical = opts.vertical,
horizontal = opts.horizontal,
split = opts.split,
} could result in an empty table, which apparently neovim v0.8 doesn't like:
Changing it from removing it completely to |
Great, thanks for the fix! |
Thank you so much for this everyone!!!! |
This ensures the alternate is set even when using
open_float()
, I copied the code fromrestore_alt_buf
, so I'm sure there could be refactor opportunities. Let me know your thoughts!Fixes: #285