Open rcoreilly opened 3 days ago
Here's a way to parameterize 2D layouts that seems sufficiently general: a list (slice) of integers specifying locations of panes in a window, up to n panes, with the number of columns additionally specified, such that the panes fully tile the 2D window space.
We can probably enumerate all the possibilities for each set of n, up to some reasonable smallish size n (it is combinatorially explosive presumably), and just have that as a list of options, displayed with graphical icons. Many cases will have rotational variants so we might want a more compact way of specifying that instead of enumerating them all. I looked for existing math on this but it was hard to specify exactly the right terms.
Note that the 1d sequential list, with row-vs-column rotation is always an option for any n. There aren't any interesting cases until N=3. We constrain the permutation of indexes such that you always start at 0 and increment to the extent possible.
In terms of splits data, we retain a simple slice of content panes as we have now, and the widget uses the 2D tiling config to decide where to put the splitters. The relevant size of each split zone should be specified with a single float as now, except that the tiling will impose constraints such that there can be fewer degrees of freedom relative to the 1D case (corresponding to fewer
012
// cols = 2:
00 // big on top
12
01 // big on bottom
22
// rotational variants:
01 // big on left
02
01 // big on right
21
// cols = 4
0123
// cols = 3
000 // big on top
123
012 // big on bottom
333
// splits for above (n=3):
0|1|2
-----
3 3 3
012 // smalls on left
312
012 // smalls in middle
032
012 // smalls on right
013
// splits for above (n = 3):
0|1|2
| |-
0|1|3
001 // long on TL, R
231
011 // long on TR, L
023
012 // long on BL, R
332
012 // long on BR, L (ideal case for Cogent Code)
033
// splits for above (n=3):
0|1|2
|---
0|3 3
// cols = 2
01
23
// rotational analogs of the cols=3 case:
01 // big on left
02
03
01 // big on right
21
31
// see above for rest of cases...
// cols = 1
0
1
2
3
Describe the feature
Double-click on splits handle to expand / collapse. makes it easier to open / close a panel discretely, without requiring any other screen real-estate for the toggle. probably want to reinstate the cascading handles so they are always visible to double-click to open, or somehow figure out another solution there.
Cogent Code supports saving / loading splits, and named splits configurations -- could use this in other apps, so put this into the base core impl.
For the double-click mechanism, we need to save the prior size of the collapsed panel, to re-open. And probably it is safer to just save the entire state of the other splits rather than trying to reconstruct based on existing proportions. How about just using a history stack and tagging the uncollapsed state in this stack?
Add a context menu (with tooltip to announce availability) on handles, to access all of the splits functionality, without requiring any new screen real-estate. This includes collapse/open (depending on current state), named splits, and a graphical display of the history of splits somehow? Also consider default keyboard shortcut for this menu (C-x C-v in Code).
To handle some of the functionality of a general-purpose dock system (#993), would be good to consider parameterizing of splits in both vertical and horizontal combinations. Could use option to put tabs into a split along bottom under 2 editors in Cogent Code, for example, instead of on the right. How do we parameterize the possible layouts in a general way?
Relevant code
No response