summaryrefslogtreecommitdiff
path: root/src/term
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 04:16:23 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitbb3d189676a9681542a61b453f0eb55208cc1311 (patch)
tree6a217f8090b6b52f30f02e6675be202ba6744a7f /src/term
parentd1300ad4283d9c22a6b0aa7426637a2d0239d536 (diff)
downloadpardes-bb3d189676a9681542a61b453f0eb55208cc1311.tar.gz
pardes-bb3d189676a9681542a61b453f0eb55208cc1311.zip
terminal: the function keys' table written out: `comptime` built it with std.fmt.comptimePrint("f{d}") a key, 25 calls of an inline function, never memoized, in every compile of the terminal (about 0.1e9 of the compiler's instructions, by the walker's measure of comptimePrint); it is the 25 tags in one line, the same table; nothing else changes
Diffstat (limited to 'src/term')
-rw-r--r--src/term/terminal.zig6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/term/terminal.zig b/src/term/terminal.zig
index fff491f6..71a2f3de 100644
--- a/src/term/terminal.zig
+++ b/src/term/terminal.zig
@@ -939,11 +939,7 @@ pub fn commandOutput(state: ?*State, gpa: std.mem.Allocator, max_rows: usize) !T
/// ask for it, written to `out`.
pub fn key(state: *State, k: Key, out: *std.Io.Writer) !void {
const input = ghostty_vt.input;
- const function_keys = comptime keys: {
- var keys: [Key.f25 - Key.f1 + 1]input.Key = undefined;
- for (&keys, 1..) |*slot, n| slot.* = @field(input.Key, std.fmt.comptimePrint("f{d}", .{n}));
- break :keys keys;
- };
+ const function_keys = [Key.f25 - Key.f1 + 1]input.Key{ .f1, .f2, .f3, .f4, .f5, .f6, .f7, .f8, .f9, .f10, .f11, .f12, .f13, .f14, .f15, .f16, .f17, .f18, .f19, .f20, .f21, .f22, .f23, .f24, .f25 };
const physical: input.Key = switch (k.cp) {
Key.enter => .enter,
Key.backspace => .backspace,