Add tab re-ordering.

This commit is contained in:
Greyson Parrelli
2026-08-14 21:21:13 -04:00
parent 695417a601
commit b50e2f4108
4 changed files with 332 additions and 19 deletions
+16 -2
View File
@@ -109,7 +109,7 @@ just the VT core.
```
main.zig AdwApplication startup
appearance.zig the colour scheme: preference -> libadwaita, CSS, palette
Window.zig sidebar + GtkStack of views, tab management, shortcuts
Window.zig sidebar + GtkStack of views, tab management, reordering, shortcuts
View.zig one tab's content: its panes, their layout, and drag handling
Layout.zig the split tree: nodes, rearranging, GtkPaned materialization
Pane.zig content plus its header, drag source, and drop target
@@ -168,6 +168,19 @@ preview. Cancelling a drag puts the pane back: only the dragged pane ever
moves, so the rest of the tree is unchanged and re-inserting it beside its
original sibling restores the original shape.
**Tabs reorder the same way.** Dragging a sidebar row moves the tab, and the
rows shuffle under the pointer as you go rather than waiting for the drop; a
copy of the row travels with the cursor while the one being moved stays dimmed
where it currently sits. Dropping in the space below the last row puts the tab
at the end, and a drag that ends anywhere else — over a pane, off the window —
is a cancel, which puts the tab back at the index it started from.
The order is the tab list itself, which is the order everything else already
reads: `Ctrl+1`..`Ctrl+9`, next/previous tab, and the startup list that "use
current tabs" captures. The sidebar follows it through a sort function rather
than by moving rows around, since taking a row out of a `GtkListBox` to put it
back elsewhere would drop the selection and the focus with it.
## Layouts
A **layout** is a saved tab: an arrangement of panes, each with a directory and
@@ -364,7 +377,8 @@ in principle, but a terminal grid is small.
- Resize reflows the grid and notifies the child
- Window title (OSC 0/2) becomes the pane header and tab label; the tab shows
its pane count once a view holds more than one
- Tabs: create, close, switch; closing the last one closes the window
- Tabs: create, close, switch, and reorder by dragging a sidebar row, with the
rows shuffling live as you drag; closing the last one closes the window
- Multiple panes per tab in an arbitrary split tree, rearranged by keyboard
or by dragging a pane's header, with draggable dividers between them;
closing the last pane in a view closes its tab