Even Split #267
Replies: 7 comments 2 replies
-
Also i would love to trigger the function to run when the Textadept window is resized but I don't see an event for that. I see I can get the windows width/height so perhaps I could poll and adjust when it changes.... |
Beta Was this translation helpful? Give feedback.
-
For (2), it's probably because the view hasn't yet been painted, so size information is not yet available. Try calling `ui.update()` before asking for and acting on sizes. You shouldn't need the timeout anymore.
|
Beta Was this translation helpful? Give feedback.
-
You are correct that there is no event on window resize. Polling is probably the way to go for now if you want it to happen automatically.
|
Beta Was this translation helpful? Give feedback.
-
There is no event when a view is unsplit.
|
Beta Was this translation helpful? Give feedback.
-
I'm starting to wonder if this can really be solved with the API. I misunderstood what For example if I split on the last view always then after two splits I have:
But if I split in half and then split the first view to make them even the size should be:
I was thinking I could adjust my process to account for this but then came across this layout:
So I split in half and then on each half split again. I can of course set the size of each view to 860. But there is no variable that I can see to see to set the size between the two splits. I.E. you can have all views with 860 and still have multiple possible layouts depending on the position of the top-level split. |
Beta Was this translation helpful? Give feedback.
-
You've identified a limitation of the API. `view.size` only applies to the view's parent split (if any). With your dual-split arrangement, each `view.size` only applies to the "sub-splits", with no way to reference or set the parent/top-level split.
|
Beta Was this translation helpful? Give feedback.
-
You are correct that there is no event on window resize. Polling is probably the way to go for now if you want it to happen automatically.
|
Beta Was this translation helpful? Give feedback.
-
I use split screens a lot. Mostly vertical splits as I have a widescreen monitor. It allows me to view several files as once.
When I tried this out in Textadept, the splitting is not exactly what I want. It cuts a screen in half vs re-distributing among all the same in that row/column.
Below is a work-in-progress module to make it so when I split the screen it gives each split panel an even amount of space among all views in that same row/column:
With this now when I hit
Cmd-V
a few times I get this which is more useful:It should also work on horizontal splits as well as nested stuff like this:
I call this a work-in-progress for a few reasons:
Cmd-V
two times in a row you get your three views all of equal size. But if you instead doCmd-V
then change the focus to the first view and split that one it ends up setting them to the wrong sizes.I'm sure I'll refine this a bit over time but wanted to at least share my early draft of this behavior.
Beta Was this translation helpful? Give feedback.
All reactions