summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index cae3a0ab..16193967 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -4446,9 +4446,21 @@ pub const Pardes = struct {
}
}
- /// place a fresh doc pane: split an existing doc (the source if it's one,
- /// else the first found), or take the left column when no doc exists yet
+ /// place a fresh doc pane. With a single column there is no separate file
+ /// column, so split BELOW the pane the look came from — the same acme split
+ /// as a dir open (splitParent picks a taller pane if the source is too
+ /// short). With two+ columns, open in the file column: split an existing
+ /// doc (the source if it's one, else the first found), or take the left
+ /// column when no doc exists yet.
fn placeDoc(p: *Pardes, from_id: usize, free: usize, nt: *Pane) void {
+ if (p.ncol == 1) {
+ const src = p.splitParent(from_id);
+ const f = p.layoutFindTerm(src).?;
+ p.layoutInsert(f.col, f.idx + 1, free);
+ p.splitBelow(src, nt);
+ p.active = free;
+ return;
+ }
var src_id: ?usize = null;
if (p.panes[from_id]) |src| if (src.file != null or src.image != null) {
src_id = from_id;