input: pc style function keys should use all mods, not effective

This commit is contained in:
Mitchell Hashimoto
2023-08-21 08:10:27 -07:00
parent e7ab16f0e1
commit 99abff85dd

View File

@ -171,7 +171,7 @@ fn legacy(
// If we match a PC style function key then that is our result. // If we match a PC style function key then that is our result.
if (pcStyleFunctionKey( if (pcStyleFunctionKey(
self.event.key, self.event.key,
binding_mods, all_mods,
self.cursor_key_application, self.cursor_key_application,
self.keypad_key_application, self.keypad_key_application,
self.modify_other_keys_state_2, self.modify_other_keys_state_2,
@ -948,6 +948,20 @@ test "legacy: fixterm awkward letters" {
} }
} }
test "legacy: shift+function key should use all mods" {
var buf: [128]u8 = undefined;
var enc: KeyEncoder = .{
.event = .{
.key = .up,
.mods = .{ .shift = true },
.consumed_mods = .{ .shift = true },
},
};
const actual = try enc.legacy(&buf);
try testing.expectEqualStrings("\x1b[1;2A", actual);
}
test "ctrlseq: normal ctrl c" { test "ctrlseq: normal ctrl c" {
const seq = ctrlSeq(.c, .{ .ctrl = true }); const seq = ctrlSeq(.c, .{ .ctrl = true });
try testing.expectEqual(@as(u8, 0x03), seq.?); try testing.expectEqual(@as(u8, 0x03), seq.?);