summaryrefslogtreecommitdiff
path: root/src/Terminal.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 14:27:29 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitf9502fa884ac3baff04de40c82b68034e02df61e (patch)
tree5af0f4233826b0e5297207ffec73b90e83c404bd /src/Terminal.zig
parente373dea7e32ab83e37c9db97ef5709786b9b2188 (diff)
downloadpardes-f9502fa884ac3baff04de40c82b68034e02df61e.tar.gz
pardes-f9502fa884ac3baff04de40c82b68034e02df61e.zip
Function keys, Insert and the keypad reach a terminal pane as their terminal sequences
Diffstat (limited to 'src/Terminal.zig')
-rw-r--r--src/Terminal.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Terminal.zig b/src/Terminal.zig
index a32819c3..c99a92a6 100644
--- a/src/Terminal.zig
+++ b/src/Terminal.zig
@@ -1113,6 +1113,11 @@ pub fn forwardKey(p: *Pardes, id: usize, key: Key) void {
const pane = p.panes[id] orelse return;
const state = pane.terminal orelse return;
const input = ghostty_vt.input;
+ const function_keys = comptime keys: {
+ var keys: [Key.f25 - Key.f1 + 1]input.Key = undefined;
+ for (&keys, 1..) |*k, n| k.* = @field(input.Key, std.fmt.comptimePrint("f{d}", .{n}));
+ break :keys keys;
+ };
const physical: input.Key = switch (key.cp) {
Key.enter => .enter,
Key.backspace => .backspace,
@@ -1127,6 +1132,12 @@ pub fn forwardKey(p: *Pardes, id: usize, key: Key) void {
Key.page_up => .page_up,
Key.page_down => .page_down,
Key.delete => .delete,
+ Key.insert => .insert,
+ Key.print_screen => .print_screen,
+ Key.scroll_lock => .scroll_lock,
+ Key.pause => .pause,
+ Key.menu => .context_menu,
+ Key.f1...Key.f25 => function_keys[key.cp - Key.f1],
else => if (key.cp < 128) input.Key.fromASCII(@intCast(key.cp)) orelse .unidentified else .unidentified,
};
var utf8: [4]u8 = undefined;