diff options
Diffstat (limited to 'src/layout.zig')
| -rw-r--r-- | src/layout.zig | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/layout.zig b/src/layout.zig index 8e44f1d9..855a3eb9 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -1000,7 +1000,7 @@ pub fn splitColumn(p: *Pardes, source_id: usize, id: usize, before: bool) bool { if (needs_rebase) old_weight *= 2; if (id == source_id) { if (p.col_n[source_col] <= 1) return false; - absorbVWeight(p, id, null); + _ = absorbVWeight(p, id, null); removePane(p, id); } else if (findPane(p, id) != null) return false; @@ -1041,9 +1041,11 @@ pub fn snapColWeights(p: *Pardes, c: usize) void { /// Hand a closing pane's rows to `to`. With none named they go up: past any /// results listing to the nearest pane above that is not one, or to the /// pane below when the closing one is first in its column. -pub fn absorbVWeight(p: *Pardes, id: usize, to: ?usize) void { - const f = findPane(p, id) orelse return; - if (p.col_n[f.col] <= 1) return; +/// Give a closing pane's rows to `to`, or to the nearest document above it +/// (the pane below for the top one); the pane that got them is returned. +pub fn absorbVWeight(p: *Pardes, id: usize, to: ?usize) ?usize { + const f = findPane(p, id) orelse return null; + if (p.col_n[f.col] <= 1) return null; snapColWeights(p, f.col); var sib = to orelse if (f.idx > 0) p.col_panes[f.col][f.idx - 1] else p.col_panes[f.col][f.idx + 1]; var k = f.idx; @@ -1051,7 +1053,9 @@ pub fn absorbVWeight(p: *Pardes, id: usize, to: ?usize) void { sib = p.col_panes[f.col][k - 1]; if (p.panes[sib]) |pp| if (if (pp.file) |ff| panes.Output.fileTraits(ff.output).doc else true) break; } - if (p.panes[sib]) |s| s.vweight += @as(f32, @floatFromInt(@max(1, p.rects[id].h))); + const s = p.panes[sib] orelse return null; + s.vweight += @as(f32, @floatFromInt(@max(1, p.rects[id].h))); + return sib; } pub fn splitParent(p: *Pardes, want: usize) usize { |
