micro
micro copied to clipboard
Child split pane is "lost" as a result of resizing its parent split pane
Steps:
Open a vertical split pane, then a horizontal split pane in it, and then a vertical split pane in it, i.e. run the following sequence of commands:
vsplit
hsplit
vsplit
Then begin dragging the initial vertical divider (the one that is in the middle of the screen), to resize the initial split pane. As a result, one of the child split panes gets narrower and narrower, and eventually its width becomes zero, so that this pane becomes completely invisible and inaccessible by the user. And there is no way to make it accessible again (no way to make its width non-zero again).
Commit hash: d8e9d61a OS: any Terminal: any
And there is no way to make it accessible again (no way to make its width non-zero again).
I understand what you mean but technically I found that user can access it again and even make it visible
-
It is still in the nodes tree so I tried to apply
Ctrl+w
several times and I cycled to the invisible split. It is invisible but you can still write there and perform actions: save file, set buffer local options... but I won't make it visible -
Close the fourth split and you will see the third
- Init layout
- After bug layout
- After closing fourth split layout
You are right, but I think all that is not so important. What's important is how to fix it. (I assume you agree that this is a bug that needs to be fixed?)
I think we have 2 issues here, likely related to each other:
- We need to ensure (recursively) that when resizing a pane, not only the width of this pane never goes below zero, but also widths of any its child panes never go below zero. E.g. if a vertical split pane has 3 child vertical split panes, then if we resize the parent pane and its width narrows down to 3 characters, we should not allow resizing it further.
- Although micro seemingly implements proportional scaling of child panes when resizing a parent pane, this proportional scaling does not work quite as it should.
Hm, from user perspective we could allow resizing till the content isn't visible any longer, but what we shouldn't allow is to resize it that low to hide the split divider, because that's the only anchor for any further access.
Yes, that's exactly the issue.
- We need to ensure (recursively) that when resizing a pane, not only the width of this pane never goes below zero, but also widths of any its child panes never go below zero. E.g. if a vertical split pane has 3 child vertical split panes, then if we resize the parent pane and its width narrows down to 3 characters, we should not allow resizing it further.
Maybe it can be done by returning from child maximum available space before 0 and if it is smaller that available space to neighbor/screen border...?