summaryrefslogtreecommitdiff
path: root/core/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/panes.zig')
-rw-r--r--core/panes.zig16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/panes.zig b/core/panes.zig
index f9c63e37..f608e6a3 100644
--- a/core/panes.zig
+++ b/core/panes.zig
@@ -32,7 +32,7 @@ pub const Pane = struct {
/// it (views.zig). (The 9P server's part of `fs` says so in its type.)
pub const replica = .{
.local = .{ "pv", "pv_known" },
- .derived = .{ "band_rows", "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "top_skip", "notices", "pan" },
+ .derived = .{ "band_rows", "ghost_at", "ghost_rows", "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "top_skip", "notices", "pan" },
.len = .{ .{ "question", "question_len" }, .{ "shell_tail", "shell_tail_len" }, .{ "sel_snap", "nsel_snap" } },
// A picture's memory is its own allocator's (a dump loaded makes
// it there).
@@ -358,6 +358,12 @@ pub const Pane = struct {
/// body layer reserves exactly `len` rows for them, the way it already
/// reserves rows for sticky context headers.
notices: Notices = .{},
+ /// A message's detail as the body drawn last has it (body_layer.zig
+ /// messageGhosts): `ghost_rows` read-only rows after body row
+ /// `ghost_at` (its line's last), the rows below drawn that many lower.
+ /// The mouse reads it, so that a click lands on what is drawn under it.
+ ghost_at: u16 = 0,
+ ghost_rows: u16 = 0,
/// Each other view's share of this pane, while it is not live
/// (views.zig): its cursor, scroll and place in that view's layout.
pv: [views.max]views.PaneView = undefined,
@@ -554,6 +560,14 @@ pub const Pane = struct {
return @min(pane.scrolled_to orelse output, output);
}
+ /// Body row `vr` as drawn, as the row map counts it (`wrapAt`): a row
+ /// under a message's detail is `ghost_rows` higher there; a row of the
+ /// detail is the line's it explains.
+ pub fn textRow(pane: *const Pane, vr: i32) i32 {
+ if (pane.ghost_rows == 0 or vr <= pane.ghost_at) return vr;
+ return @max(pane.ghost_at, vr - pane.ghost_rows);
+ }
+
/// The line and byte a body row shows from.
pub fn wrapAt(pane: *Pane, tab: u16, vr: i32) struct { line: i32, at: i32, pad: i32 = 0 } {
File.geometry(tab, pane);