diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-24 10:05:01 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-24 10:14:38 -0300 |
| commit | 873f81ccb1449119846de8d4e6e0e8899236100a (patch) | |
| tree | 66ad8ca2e913e4a954be947c54aa0b31a0c9fdb0 /src/builtins.zig | |
| parent | 19c83c90ebed4817acd7a12d4d225f5af0957bc1 (diff) | |
| download | pardes-873f81ccb1449119846de8d4e6e0e8899236100a.tar.gz pardes-873f81ccb1449119846de8d4e6e0e8899236100a.zip | |
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
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 15 |
1 files changed, 14 insertions, 1 deletions
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 { |
