summaryrefslogtreecommitdiff
path: root/core/layout.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/layout.zig')
-rw-r--r--core/layout.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/layout.zig b/core/layout.zig
index 2a5d2cf3..9c15833d 100644
--- a/core/layout.zig
+++ b/core/layout.zig
@@ -1514,14 +1514,17 @@ fn floorRows(p: *Pardes, id: usize) u16 {
/// the column has not the rows, the terminal keeps what it could get.
// ponytail: a row per step, O(panes x rows); a column holds few of both.
fn keepTerminalFloors(p: *Pardes, c: usize, hs: []u16) void {
+ // Each pane's floor once a pass: a band's wraps its tag twice
+ // (floorRows), and nothing here moves it.
+ var floors: [MAX_PANES]u16 = undefined;
+ for (floors[0..hs.len], 0..) |*floor, k| floor.* = floorRows(p, p.view().cols[c].panes[k]);
for (hs, 0..) |*h, k| {
- const floor = floorRows(p, p.view().cols[c].panes[k]);
- while (h.* < floor) {
+ while (h.* < floors[k]) {
var giver: ?usize = null;
var spare: u16 = 0;
for (hs, 0..) |other, j| {
if (j == k) continue;
- const extra = other -| floorRows(p, p.view().cols[c].panes[j]);
+ const extra = other -| floors[j];
if (extra > spare) {
spare = extra;
giver = j;