aboutsummaryrefslogtreecommitdiffstats
path: root/src/app_ui.c
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-20 23:22:33 +0200
committeruser <user@clank>2026-08-20 23:22:33 +0200
commitb33e8c13ff7981effc7ec2735e6aeaaaf1705af7 (patch)
tree4933eb476b5d09e9d8131986c84bb966bca317a2 /src/app_ui.c
parentfuzz: libFuzzer harness for all six parser surfaces (diff)
downloadslosh-b33e8c13ff7981effc7ec2735e6aeaaaf1705af7.tar.gz
slosh-b33e8c13ff7981effc7ec2735e6aeaaaf1705af7.tar.xz
slosh-b33e8c13ff7981effc7ec2735e6aeaaaf1705af7.zip
slosh: floating panes and the drop grammar
A pane can float: lifted out of the layout, drawn over the tiled panes and under the modals, freely moved and shaped. The model is a flag and a rect on the leaf, exactly like `minimized` -- the seat in the tree is kept, layout skips it, the siblings absorb its share, and un-floating returns it home. The drawn rect is the wanted one clamped to the tab every frame, never written back, so a terminal squeeze round-trips exactly; an explicit move or resize *does* write back, because the hand is the author of the intent. Floating pops the pane to the centre: the jump is what says it happened. Painted after everything tiled, so the hit list -- searched backwards -- resolves an overlap to the float you can see: the z-order and the click order are the same list. It casts a shadow (float_shadow, one number), and `floating` joins the states table above `unfocused`, so a float is never dimmed as merely-unfocused. The hands: the title moves it, any other border resizes it (a bottom corner on both axes; the grabbed edge pins at walls and floors, never sliding the window), H J K L move a focused float, the =/+ key grows it about its centre, `-` shrinks it (its split was a refusal anyway), and hovering shows which edges a grab would take, from the same derivation the press uses. Equalize moved to `0` to free the key; `C-a f` floats (finder went to `s`, where it reads as search); `C-a F` opens a new floating shell -- the throwaway terminal; the function row f1..f12 became nameable in configs along the way. Guards throughout: the last tiled pane cannot float or minimize away, closing it lands the top float, splits are refused with their own words, floats are not swap targets. Dropping got a grammar: while a pane is carried, the pane under the pointer subdivides into a swap centre and four edge bands meaning "insert me beside this pane, on this side" -- detach_leaf + place_beside, the surgery cross-tab moves already had. Bands are thirds (the first map of quarters showed the swap owning half of each axis), the hovered band fills the half the drop would hand over, the release resolves against the painted frame's hits so it cannot disagree with the fill, and a drop between siblings along the axis is a reorder that always fits -- refusing it was refusing the most ordinary drag there is. Also: rename-pane/rename-tab as palette actions (renaming was a double-click and nothing else, the one verb the palette could not reach), and C-u clears the rename editor like it clears the picker's query. Design log in PLAN-FLOATING-PANES.md; to fold into DESIGN.md as D22/M10-11.
Diffstat (limited to 'src/app_ui.c')
-rw-r--r--src/app_ui.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/app_ui.c b/src/app_ui.c
index ec4a6ef..d9e231c 100644
--- a/src/app_ui.c
+++ b/src/app_ui.c
@@ -950,6 +950,17 @@ bool rename_key(app_t *a, const input_event_t *ev) {
if (!a->renaming) return false;
if (ev->kind != EV_KEY || ev->action == KEY_RELEASE) return true;
+ /* The same C-u the picker's query field has: these are the program's two
+ * places you type into, and a key that clears one and is swallowed by the
+ * other is a key you cannot trust. It earns its place here twice over,
+ * because a rename seeds with the current label — an edit, usually — and
+ * "replace it outright" is otherwise a backspace per character. */
+ if ((ev->mods & MOD_CTRL) &&
+ (ev->key == GHOSTTY_KEY_U || ev->unshifted == 'u')) {
+ a->rename_buf[0] = 0;
+ return true;
+ }
+
switch (ev->key) {
case GHOSTTY_KEY_ESCAPE: rename_end(a, false); return true;
case GHOSTTY_KEY_ENTER: rename_end(a, true); return true;
@@ -996,6 +1007,15 @@ void app_compose(app_t *a, screen_t *s) {
draw_node(a, s, cur(a)->root);
draw_corners(a, s);
draw_min_bar(a, s);
+ /* The floats, over everything tiled and under the modals below: painted
+ * later is on top, and the hit list resolves clicks the same way, so the
+ * z-order and the click order cannot disagree. Before the status line,
+ * which cannot overlap them (the clamp keeps floats off it) but reads the
+ * hit list for its hover hint — drawn first, it would ask about a frame
+ * whose hits did not exist yet, and a float's border would hint as the
+ * pane underneath. The order also keeps a float's shadow off the status
+ * row on a gap-less config, since the row is painted after the shade. */
+ draw_floats(a, s);
draw_status_line(a, s);
/* The modals, on top of everything: each is the only thing that can be
* interacted with while it is up, so it owns the topmost hits. The scrim