mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
@ -1106,6 +1106,52 @@ test "legacy: keypad enter" {
|
||||
try testing.expectEqualStrings("\r", actual);
|
||||
}
|
||||
|
||||
test "legacy: f1" {
|
||||
var buf: [128]u8 = undefined;
|
||||
var enc: KeyEncoder = .{
|
||||
.event = .{
|
||||
.key = .f1,
|
||||
.mods = .{ .ctrl = true },
|
||||
.consumed_mods = .{},
|
||||
},
|
||||
};
|
||||
|
||||
// F1
|
||||
{
|
||||
enc.event.key = .f1;
|
||||
const actual = try enc.legacy(&buf);
|
||||
try testing.expectEqualStrings("\x1b[1;5P", actual);
|
||||
}
|
||||
|
||||
// F2
|
||||
{
|
||||
enc.event.key = .f2;
|
||||
const actual = try enc.legacy(&buf);
|
||||
try testing.expectEqualStrings("\x1b[1;5Q", actual);
|
||||
}
|
||||
|
||||
// F3
|
||||
{
|
||||
enc.event.key = .f3;
|
||||
const actual = try enc.legacy(&buf);
|
||||
try testing.expectEqualStrings("\x1b[1;5R", actual);
|
||||
}
|
||||
|
||||
// F4
|
||||
{
|
||||
enc.event.key = .f4;
|
||||
const actual = try enc.legacy(&buf);
|
||||
try testing.expectEqualStrings("\x1b[1;5S", actual);
|
||||
}
|
||||
|
||||
// F5 uses new encoding
|
||||
{
|
||||
enc.event.key = .f5;
|
||||
const actual = try enc.legacy(&buf);
|
||||
try testing.expectEqualStrings("\x1b[15;5~", actual);
|
||||
}
|
||||
}
|
||||
|
||||
test "ctrlseq: normal ctrl c" {
|
||||
const seq = ctrlSeq(.c, .{ .ctrl = true });
|
||||
try testing.expectEqual(@as(u8, 0x03), seq.?);
|
||||
|
@ -87,10 +87,10 @@ pub const keys = keys: {
|
||||
result.set(.page_down, pcStyle("\x1b[6;{}~") ++ .{.{ .sequence = "\x1B[6~" }});
|
||||
|
||||
// Function Keys. todo: f13-f35 but we need to add to input.Key
|
||||
result.set(.f1, pcStyle("\x1b[11;{}~") ++ .{.{ .sequence = "\x1BOP" }});
|
||||
result.set(.f2, pcStyle("\x1b[12;{}~") ++ .{.{ .sequence = "\x1BOQ" }});
|
||||
result.set(.f3, pcStyle("\x1b[13;{}~") ++ .{.{ .sequence = "\x1BOR" }});
|
||||
result.set(.f4, pcStyle("\x1b[14;{}~") ++ .{.{ .sequence = "\x1BOS" }});
|
||||
result.set(.f1, pcStyle("\x1b[1;{}P") ++ .{.{ .sequence = "\x1BOP" }});
|
||||
result.set(.f2, pcStyle("\x1b[1;{}Q") ++ .{.{ .sequence = "\x1BOQ" }});
|
||||
result.set(.f3, pcStyle("\x1b[1;{}R") ++ .{.{ .sequence = "\x1BOR" }});
|
||||
result.set(.f4, pcStyle("\x1b[1;{}S") ++ .{.{ .sequence = "\x1BOS" }});
|
||||
result.set(.f5, pcStyle("\x1b[15;{}~") ++ .{.{ .sequence = "\x1B[15~" }});
|
||||
result.set(.f6, pcStyle("\x1b[17;{}~") ++ .{.{ .sequence = "\x1B[17~" }});
|
||||
result.set(.f7, pcStyle("\x1b[18;{}~") ++ .{.{ .sequence = "\x1B[18~" }});
|
||||
|
Reference in New Issue
Block a user