From 98f84f99e79cccc2344aff2efe10823540d0c7b7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 03:06:49 -0300 Subject: plain: the records the core and the terminal both name, a leaf module (docs/next-terminal.md, Phase 1, its first step): src/plain/plain.zig takes Color, FontRole, CellStyle, Cell, RectPx, RectCell, Raster and Placement from surface.zig and Key from Event.zig, moved as they are, and imports std alone; surface.zig and Event.zig re-export them under their old names, so no caller changes; src/term/'s files name them through `plain` (pager.zig and TerminalImages.zig no longer reach surface.zig); build.zig's wireCore gives every core module the `plain` import; locations.Row stays (it names look.Spot and walk's digest: not free); core-test 985 of 985, lib-test --- src/Event.zig | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'src/Event.zig') diff --git a/src/Event.zig b/src/Event.zig index aa93f412..faea73cc 100644 --- a/src/Event.zig +++ b/src/Event.zig @@ -49,36 +49,7 @@ pub const Mouse = struct { amount: f32 = 0, }; -pub const Key = struct { - cp: u21, // codepoint or one of the specials below - text: []const u8 = "", - ctrl: bool = false, - alt: bool = false, - shift: bool = false, - - pub const enter: u21 = 0x0D; - pub const escape: u21 = 0x1B; - pub const tab: u21 = 0x09; - pub const backspace: u21 = 0x7F; - // private-use plane for non-text keys, matching no real codepoint - pub const up: u21 = 0xF0001; - pub const down: u21 = 0xF0002; - pub const left: u21 = 0xF0003; - pub const right: u21 = 0xF0004; - pub const home: u21 = 0xF0005; - pub const end: u21 = 0xF0006; - pub const page_up: u21 = 0xF0007; - pub const page_down: u21 = 0xF0008; - pub const delete: u21 = 0xF0009; - pub const insert: u21 = 0xF000A; - pub const print_screen: u21 = 0xF000B; - pub const scroll_lock: u21 = 0xF000C; - pub const pause: u21 = 0xF000D; - pub const menu: u21 = 0xF000E; - /// F1 to F25, in order: Fn is `f1 + n - 1`. - pub const f1: u21 = 0xF0011; - pub const f25: u21 = f1 + 24; -}; +pub const Key = @import("plain").Key; pub fn hit(key: Key, binding: []const config.Chord) bool { for (binding) |c| { -- cgit v1.3