input: control-encode right control properly

pull/7320/head
Mitchell Hashimoto 2025-05-09 10:16:10 -07:00
parent 54bd701ba9
commit 293a67cd01
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 12 additions and 2 deletions

View File

@ -571,7 +571,9 @@ fn ctrlSeq(
if (!mods.ctrl) return null;
const char, const unset_mods = unset_mods: {
var unset_mods = mods;
// We need to only get binding modifiers so we strip lock
// keys, sides, etc.
var unset_mods = mods.binding();
// Remove alt from our modifiers because it does not impact whether
// we are generating a ctrl sequence and we handle the ESC-prefix
@ -640,7 +642,7 @@ fn ctrlSeq(
// only matches Kitty in behavior. But I believe this is a
// justified divergence because it's a useful distinction.
break :unset_mods .{ char, unset_mods.binding() };
break :unset_mods .{ char, unset_mods };
};
// After unsetting, we only continue if we have ONLY control set.
@ -2280,3 +2282,11 @@ test "ctrlseq: russian alt ctrl c" {
const seq = ctrlSeq(.key_c, "с", 0x0441, .{ .ctrl = true, .alt = true });
try testing.expectEqual(@as(u8, 0x03), seq.?);
}
test "ctrlseq: right ctrl c" {
const seq = ctrlSeq(.key_c, "с", 'c', .{
.ctrl = true,
.sides = .{ .ctrl = .right },
});
try testing.expectEqual(@as(u8, 0x03), seq.?);
}