From a354d34329de597b80943c78e2afd84f235ee505 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 3 Jul 2026 18:49:00 -0300 Subject: improving layout --- main.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'main.zig') diff --git a/main.zig b/main.zig index cd760ecf..742d43b4 100644 --- a/main.zig +++ b/main.zig @@ -1114,6 +1114,10 @@ fn termVWeight(terms: *const [MAX_TERMS]?*Term, id: usize) ?f32 { return if (terms[id]) |t| t.vweight else null; } +fn setTermVWeight(terms: *[MAX_TERMS]?*Term, id: usize, weight: f32) void { + if (terms[id]) |t| t.vweight = weight; +} + // `alloc` must be a per-frame arena, NOT freed before vx.render(): vaxis is a // retained renderer and stores each cell's grapheme as a *slice* into the text // we hand it, so plainString has to outlive the render call. @@ -3019,7 +3023,7 @@ pub fn main(init: std.process.Init) !void { } }, .move => |d| { - moveTerm(&layout, &rects, &col_x, &col_w, d.id, d.cur_x, d.cur_y); + moveTerm(&layout, &terms, &rects, &col_x, &col_w, d.id, d.cur_x, d.cur_y, setTermVWeight); // a file moved into the left column evicts a lone unused shell there if (terms[d.id]) |mt| if (mt.file != null) { if (layoutFindTerm(&layout, d.id)) |f| if (f.col == 0) -- cgit v1.3