diff options
Diffstat (limited to 'src/panes.zig')
| -rw-r--r-- | src/panes.zig | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/panes.zig b/src/panes.zig index 9a6802d0..e41698bb 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -183,6 +183,34 @@ pub const Pane = struct { tty_filter: bool = false, msg: [256]u8 = undefined, msg_len: u16 = 0, + /// The transient lines this pane shows between its body and its tagline: + /// a builtin's message, the pending leader chord, a prompt waiting for + /// input. Rebuilt every frame from the state that owns each one, so a + /// line that goes away is simply not added again and the rest close the + /// gap -- there is no second copy of the truth to fall out of step. The + /// body layer reserves exactly `len` rows for them, the way it already + /// reserves rows for sticky context headers. + notices: Notices = .{}, + + pub const Notices = struct { + /// Painted bottom-up in this order, so a prompt keeps the row nearest + /// the tagline that it has always had, and its cursor with it. + pub const Kind = enum { message, leader, prompt }; + pub const max = @typeInfo(Kind).@"enum".fields.len; + + kinds: [max]Kind = undefined, + len: u8 = 0, + + pub fn push(n: *Notices, kind: Kind) void { + if (n.len >= max) return; + n.kinds[n.len] = kind; + n.len += 1; + } + + pub fn slice(n: *const Notices) []const Kind { + return n.kinds[0..n.len]; + } + }; pub fn clearPointerSelection(pane: *Pane, slot: usize) void { if (pane.pointer_selections[slot]) |selection| { |
