-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: use relative = 'editor', add overlap options #44
Conversation
I do need to add to the help file, but the doc tests are failing at the checkout step and the errors from the schema validation tests are a bit incomprehensible. Mind giving some info on what changes would be required in the Edit: actually looks like similar errors are occurring on |
Thanks for these PRs. I'm going to look into the failing tests on main and will update you. |
Sounds good! |
Hi again! I'm sorry for the long delay, I was on vacation for about a month. I fixed the failing tests and docs build on main. If you rebase on top of main, and then in Regarding the functionality, this change has a lot of edge cases to consider. There are many possible combinations of the following:
Here are a few issues I found:
There are also a few ambiguities:
I know that's a lot to consider. Let me know if you have any thoughts or ideas. I really do like the direction this PR is going, I think if we can figure out these issues that it will be a big improvement over the current positioning behavior. |
Thanks! Will do.
Definitely expected this to be the case, I'll start working through those this week. Thanks for the very detailed testing and info!
I didn't intend for that to be the behavior of
Since this PR is already adding options for overlap, maybe this shouldn't be a special case anymore? Definitely seems more user-friendly to have a named option. |
b9e76b4
to
ed84bca
Compare
I agree, it would be better for it to be an explicit option. |
I'm a bit busy right now but I'll try to get to this in the next week or two :) |
Oops I totally forgot about this PR, my bad! I definitely still want to move this forwards since I've been using it - I'll get started on those edge cases and the additional option ASAP. |
Awesome, looking forward to it! |
Oops I forgot about issue references lol my bad |
We are gonna need a lot of tests to make sure this actually works, there are so many possible configs |
Also the docs check is broken, failure is not related to this PR. |
Alright, I think this should be ready for another review pass. There may be some more edge cases to figure out since there are a lot of possible configs. Also I will definitely simplify the main changed area as much as possible, it's definitely messier than it needs to be atm - just wanted to get it working for now lol. |
Thanks @willothy! I'll review this over the weekend. (Btw I disabled the docs workflow on PRs so that workflow failure should no longer appear) |
Overall this is looking good and feels more responsive! Some edge cases I noticed where cursorline hiding is off by one line:
hide = {
cursorline = true,
},
window = {
margin = { horizontal = 0, vertical = 1 },
placement = { horizontal = 'right', vertical = 'top' },
overlap = {
tabline = false,
winbar = true,
borders = false,
statusline = false,
},
}
hide = {
cursorline = true,
},
window = {
margin = { horizontal = 0, vertical = 0 },
placement = { horizontal = 'right', vertical = 'top' },
overlap = {
tabline = true,
winbar = false,
borders = false,
statusline = false,
},
padding = 0,
zindex = 49,
winhighlight = {
active = { Normal = 'Normal' },
inactive = { Normal = 'Normal' },
},
} It would definitely be nice to figure out how to unit test the placement and hiding since there are so many edge cases, but we can figure that out later. Other than that I think it looks good! |
Cool, glad it's working better than before! I'll look into those cursorline issues today. |
fix: cursorline hiding off by one
Ok I think I've fixed that edge case with the tabline, and fixed another I found where if both tabline and winbar were hidden the window would not be visible. |
Nice! Seems like there's only one edge case now: When |
Awesome! I'll try and get that fixed today. I think I might've broken that with the last fix lol |
Ahhhh I hope that didn't re-break something else lol |
That still isn't quite working. This seems to fix it: diff --git a/lua/incline/winline.lua b/lua/incline/winline.lua
index c687b8d..aa2ceed 100644
--- a/lua/incline/winline.lua
+++ b/lua/incline/winline.lua
@@ -70,7 +70,7 @@ function Winline:get_win_geom_row()
-- statusline if laststatus is not 3
-- TODO(willothy): this can obviously be simplified a lot, there is a good bit of repetition
- if vim.o.laststatus ~= 3 or a.nvim_win_get_position(self.target_win)[1] <= 1 then
+ if a.nvim_win_get_position(self.target_win)[1] <= 1 then
if cw.margin.vertical.top == 0 then
if
config.window.overlap.tabline
@@ -223,7 +223,8 @@ function Winline:render(opts)
end
if
(config.hide.cursorline == true or (config.hide.cursorline == 'focused_win' and self.focused))
- and self:get_win_geom_row() == a.nvim_win_call(self.target_win, vim.fn.winline)
+ and (self:get_win_geom_row() + ((vim.wo[self.target_win].winbar == '') and 1 or 0))
+ == a.nvim_win_call(self.target_win, vim.fn.winline)
then
self:hide(HIDE_TEMP)
return Would you mind testing that and, if it seems to work for you, making a commit? |
Looks like that works! |
Awesome, thank all of your work and persistence! |
Super exciting! Took a while but I think the flexibility is awesome. |
When using plugins such as
mini.animate
, status windows on the right-hand side of the editor flicker and move when they should stay in place. This is because of therelative="win"
option in the windows' config, which causes them to move automatically during resize at the same time as they're moved by the incline manager. Moving torelative="editor"
and manually applying window position offsets fixes this, and results in much smoother movement.This also allows the plugin to ignore the winbar for the top-level window if configured to do so.
I also added an option to overlap the tabline, in case anyone wants that (happy to remove that if it's not wanted).
Edit:
closes #27