summaryrefslogtreecommitdiff
path: root/src/Event.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 03:06:49 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit98f84f99e79cccc2344aff2efe10823540d0c7b7 (patch)
tree0e11fcb0a2252858dc8c7b442a9c78152af5a585 /src/Event.zig
parentf749eb712d990a9b03f1db372d5311e77bd32edd (diff)
downloadpardes-98f84f99e79cccc2344aff2efe10823540d0c7b7.tar.gz
pardes-98f84f99e79cccc2344aff2efe10823540d0c7b7.zip
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
Diffstat (limited to 'src/Event.zig')
-rw-r--r--src/Event.zig31
1 files changed, 1 insertions, 30 deletions
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| {