summaryrefslogtreecommitdiff
path: root/src/body_layer.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/body_layer.zig')
-rw-r--r--src/body_layer.zig25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/body_layer.zig b/src/body_layer.zig
index bfca268a..5bffb691 100644
--- a/src/body_layer.zig
+++ b/src/body_layer.zig
@@ -169,22 +169,17 @@ pub fn buttonInks(th: *const colors.Theme) [3][3]u8 {
/// rows the grid cannot show, and is painted straight onto the grid. The
/// rail is the grid's alone.
pub fn joinBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize, active: bool, rail: pardes.Region) !void {
- const file = if (pane.file) |*f| f else return renderBody(p, s, arena, pane, r, id, active, rail, null);
- if (!p.settings.tree_context_tag_style or pane.collapsed or r.h <= pane.tag_rows)
+ if (pane.file == null) return renderBody(p, s, arena, pane, r, id, active, rail, null);
+ // Made afresh for every frame from the pane as it is, as a step reading
+ // it would make it (File.geometry): never only by drawing.
+ pane.geometry_key = 0;
+ panes.File.geometry(pane);
+ // Which rows are context rows is decided by the text the body shows: a
+ // layer taller than the grid's rows when there are any.
+ if (!p.settings.tree_context_tag_style or pane.collapsed or r.h <= pane.tag_rows or pane.body_rows == 0)
return renderBody(p, s, arena, pane, r, id, active, rail, null);
- // Which rows are context rows is decided by the text the body shows.
- const text = try panes.File.bodyText(arena, pane, file, p.settings.wrap);
const viewport_rows = r.h - pane.tag_rows;
- const logical_rows = @min(@as(usize, pane.rows) + pane.context_rows, pane.wrap_line.len);
- if (pane.context_rows == 0 or logical_rows <= pane.context_rows)
- return renderBody(p, s, arena, pane, r, id, active, rail, text);
- pane.body_rows = @intCast(logical_rows);
- const bh: usize = @max(1, p.row_metrics.body_h);
- const th: usize = std.math.clamp(p.row_metrics.tagline_h, 1, bh);
- const body_pixels = @as(usize, viewport_rows) * bh;
- pane.context_row_limit = @intCast(@min(pane.context_rows, (body_pixels -| bh) / th));
- const context_pixels = @as(usize, pane.context_row_limit.?) * th;
- pane.body_visible_rows = @intCast(@min(logical_rows, pane.context_row_limit.? + @max(1, (body_pixels -| context_pixels) / bh)));
+ const logical_rows: usize = pane.body_rows;
const width = r.w - config.GUTTER;
const layer = &s.body_layers[id];
const count = logical_rows * width;
@@ -512,6 +507,6 @@ pub fn bodyText(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) ![]const u8 {
);
unreachable;
}
- if (pane.file) |*f| return panes.File.bodyText(arena, pane, f, p.settings.wrap);
+ if (pane.file) |*f| return panes.File.bodyText(arena, pane, f);
return panes.terminal.bodyText(arena, pane);
}