summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index d3376273..31757732 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -4940,19 +4940,24 @@ pub const Pardes = struct {
p.placeDoc(id, free, np);
}
- /// place a fresh doc pane. Any doc already open is the split parent (the
+ /// place a fresh doc pane. An OUTPUT buffer (+Search/+Help) is NOT a
+ /// document: it is the result list belonging to the pane that asked for it,
+ /// so it never claims a column and is never anyone else's split parent — it
+ /// lands right below `from_id`, be that a shell, a file or another list.
+ /// A real doc joins the docs: any doc already open is the split parent (the
/// source if it IS one, else the first found) and the newcomer lands right
/// below it, so all docs share one column. The FIRST doc of the session
/// instead gets a column of its own on the left (acme: files left, shells
- /// right) — nothing is displaced, the other columns just narrow. Only a
- /// full column bar falls back to stacking into the leftmost one.
+ /// right) — nothing is displaced, the other columns just narrow. A full
+ /// column bar, or a result list whose source died, stacks into the leftmost.
fn placeDoc(p: *Pardes, from_id: usize, free: usize, nt: *Pane) void {
+ const doc = if (nt.file) |f| !f.output else true; // an image is a doc
var src_id: ?usize = null;
- if (p.panes[from_id]) |src| if (src.file != null or src.image != null) {
+ if (p.panes[from_id]) |src| if (!doc or (if (src.file) |f| !f.output else src.image != null)) {
src_id = from_id;
};
- if (src_id == null) for (p.panes, 0..) |sl, i| {
- if (sl) |pp| if ((pp.file != null or pp.image != null) and i != free) {
+ if (doc and src_id == null) for (p.panes, 0..) |sl, i| {
+ if (sl) |pp| if (i != free and (if (pp.file) |f| !f.output else pp.image != null)) {
src_id = i;
break;
};
@@ -4965,7 +4970,7 @@ pub const Pardes = struct {
p.active = free;
return;
}
- if (p.ncol < MAX_COLS) {
+ if (doc and p.ncol < MAX_COLS) {
p.layoutInsertColumn(0, free);
p.active = free;
return;