summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig15
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 {