summaryrefslogtreecommitdiff
path: root/src/input/KeyEncoder.zig
diff options
context:
space:
mode:
authorMitchell Hashimoto <m@mitchellh.com>2025-05-09 10:16:10 -0700
committerMitchell Hashimoto <m@mitchellh.com>2025-05-09 10:16:21 -0700
commit293a67cd01a1fdb8a131c4591c078f49aa6dd3d3 (patch)
treecde4931e07fad423e5894bb0d6e3e04f35e1a9c6 /src/input/KeyEncoder.zig
parent54bd701ba973bee77163408b6438d97e98b5ff5e (diff)
input: control-encode right control properly
Diffstat (limited to 'src/input/KeyEncoder.zig')
-rw-r--r--src/input/KeyEncoder.zig14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/input/KeyEncoder.zig b/src/input/KeyEncoder.zig
index 7f9972779..5dfcf7ff5 100644
--- a/src/input/KeyEncoder.zig
+++ b/src/input/KeyEncoder.zig
@@ -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.?);
+}