From 873f81ccb1449119846de8d4e6e0e8899236100a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 24 Oct 2026 10:05:01 -0300 Subject: Search converge 1/6: attached panes, a pane under its owner on the owner's rows alone, fixed height, moving, folding and closing with it --- src/builtins.zig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index 64710554..1ec33d88 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1283,9 +1283,12 @@ pub const Del = struct { // acme's Del asks winclean first (exec.c del): unsaved text is warned // about once, and the same Del again, nothing edited since, closes. if (warnModifiedIn(c, .Del, .{ .pane = c.id })) return; + // An attachment's rows go back to its owner: nothing to ask. + if (layout.ownerOf(c.p, c.id)) |owner| return c.p.removePane(c.id, owner) catch |err| c.p.reportError(c.id, "close", err); const at = layout.findPane(c.p, c.id); const above = if (at) |f| layout.expandedNeighbor(c.p, f.col, f.idx, .above) else null; - const below = if (at) |f| layout.expandedNeighbor(c.p, f.col, f.idx, .below) else null; + // An owner's attachments close with it: below is past them. + const below = if (at) |f| layout.expandedNeighbor(c.p, f.col, layout.groupEnd(c.p, f.col, f.idx) - 1, .below) else null; const to: ?usize = if (std.mem.eql(u8, side, "k")) above orelse below else if (std.mem.eql(u8, side, "j")) @@ -1394,6 +1397,16 @@ pub const Collapse = struct { } }; +/// Unattach a pane from the pane it answers for: it stays where it is, a +/// pane of its own, and the next search from that pane opens another +/// under it. +pub const Unattach = struct { + pub fn run(c: Ctx) void { + if (c.pane.attached_to == null) return c.p.reportFailure(c.id, "Unattach: not attached to a pane"); + c.pane.attached_to = null; + } +}; + /// Close this column and its panes, refusing once over unsaved text. pub const Delcol = struct { pub fn run(c: Ctx) void { -- cgit v1.3