diff options
Diffstat (limited to 'core/Core.zig')
| -rw-r--r-- | core/Core.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/Core.zig b/core/Core.zig index 769d16cd..85087b11 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -89,6 +89,21 @@ const Pardes = @This(); /// its focus, its pointer and gestures, its jumps, its key prefixes. pub const View = struct { pub const replica = .{ .len = .{ .{ "leader_keys", "leader_n" }, .{ "col_x", "ncol" }, .{ "col_w", "ncol" } } }; + /// A view's slot in `Pardes.views`, as it crosses the core's edge: an + /// entry's argument or answer, the wire's welcome. A type of its own, + /// so a pane's slot (`Pane.Id`) is not taken for it; the core's own + /// view indexes (`live`, views.zig) keep their integers. + pub const Id = enum(u8) { + _, + /// The id of slot `k`, a slot the core holds. + pub fn at(k: usize) Id { + return @fromBackingInt(@intCast(k)); + } + /// The slot, to index the core's views with. + pub fn index(id: Id) u8 { + return @backingInt(id); + } + }; screen_w: u16 = 0, screen_h: u16 = 0, |
