-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix last split cannot be resized #3825
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
base: master
Are you sure you want to change the base?
Conversation
…split in a group of siblings. The general strategy for changing the size of a split is to set the size of the selected split and adjust the size of the split to its right according to the remaining space. This calculation works for all cases except the last split. Instead of directly setting the size of the selected (last) split, the existing strategy is to calculate the necessary size of the split to its left based on the available space and thus indirectly adjust the size of the selected split. However, the necessary adjustment of the new size is missing.
The entire design of the function is somewhat peculiar. Resizing to the right/bottom works well. However you cannot choose the direction in which you wish to resize, and therefore must deal with additional logic to achieve resizing to the left/top.
|
I forgot to mention this fixes issues/3046. |
|
Yeah got the same issure when resizing and worked around it by just resizing the previous one 😂 -- NOTE: Dumb hack where ResizePane() actually resizes the previous node if the current node
-- is at the end
if isEnd then
n = n * -1
node = prevNode
endIt's good to fix this but the change of function signature will break any plugins that use it, is there a way around it? At least for bufpane? |
|
Hey @Neko-Box-Coder, sorry for the late reply, I somehow missed your message. What would you suggest? I changed the signature of the functions so that they match the existing and working function signature used by Isn't it generally a good thing to be able to remove hacks from your plugins? |
Yes, ideally the goal is to not have hacks while minimizing the damage of breaking any existing code. I guess it's not just my plugin as well since I grabbed the resizing code snippet somewhere else. If you change the function signature, it breaks panes resizing no matter what, even if the panes that are being resized are not at the end Shouldn't the correct behavior for the original So for example if I have 3 panes and the last pane has size 50, doing Don't get me wrong, I am up for adding a direction option, but it should be as another function instead. |
vResizeSplitandhResizeSplitcannot change the size of the last split in a group of siblings. It resizes the split before the last split instead.How to reproduce:
At first, I just fixed the bug, but then I found the entire design of
vResizeSplitandhResizeSplita bit strange.So I thought it would be a good idea to change
vResizeSplitandhResizeSplitso that they work the same way asVSplitandHSplit. This way, you can easily select the direction in which you want to resize. With the old design, you have to use a lot of extra logic in Lua to enable resizing to the left or top.Fixes #3046