Automatically Cull Empty Panes When Traveling Away#150
Conversation
…them (configured via "destroy_empty_panes", defaults to False)
|
I use this fork. It works as expected for me. I see no reason not to merge! Thanks @faelin |
|
@rchl thank you for converting the whitespacing, apparently I completely forgot to do that after you suggested it! |
|
While testing, I've noticed that if we have two columns and one of them is split in two rows then switching away from the column with two rows doesn't destroy the empty row pane. That seems unexpected considered the description of the option that doesn't mention any exceptions like that. Screen.Recording.2021-03-08.at.20.48.00.mov |
update `window.get_layout()` to newer `window.layout()`
…ould now be destroyed.
|
I appreciate the detailed explanation and sorry for not getting back to you earlier. Even though I have planned so, I've never managed to invest enough time into Origami to incorporate it into my workflows so I'm not super invested in it and don't have a very strong opinion on this matter either. For me the options right now are either:
Let me know what you think and we can go either way. |
|
Personally, I use this functionality literally every day that I work in Sublime (which is why I added the ability)! My strong preference would be to merge in the current implementation; as it stands, even in the error-case you described, a user can still collapse the empty panes by simply traversing their cursor in the reverse of the order in which they created the pane (i.e. "retracting their steps"), so even though the auto-destroy is not perfect, it can still ultimately handle even the situation you describe. I will continue fiddling with the code in my spare time, and can generate a new PR when I have a more comprehensive fix. In the meanwhile, users already expect to destroy panes via explicit commands, and so it seems reasonable to assume that new adopters of this feature would be able to use the "destroy pane" command if they somehow get stuck. To be clear, I want to stress that users can still automatically destroy panes by simply traversing to the sub-divided pane (in the example layout you constructed, I would have labeled it "E" per the images above) and then traversing upward to the "parent" of the group. |









This is a small change to Origami that provides a configurable option ("destroy_empty_panes") in the Origami settings (default is to ignore this behavior).
When enabled, Origami will automatically destroy panes that no longer contain any content (i.e. no open views) when traveling away from them.
The following GIFs demonstrate the new functionality:


(note: I accidentally modified whitespace, and I am not git-savvy enough to easily fix this via patch)