From 91456fe420d266425d92511216812e2395bbe465 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 17 Aug 2023 11:23:13 -0700 Subject: [PATCH] input: repeat events need to be handled for Kitty w/o report events --- src/input/KeyEncoder.zig | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/input/KeyEncoder.zig b/src/input/KeyEncoder.zig index c7f2842b2..9daa41816 100644 --- a/src/input/KeyEncoder.zig +++ b/src/input/KeyEncoder.zig @@ -42,7 +42,7 @@ fn kitty( if (self.kitty_flags.int() == 0) return try self.legacy(buf); // We only processed "press" events unless report events is active - if (self.event.action != .press and !self.kitty_flags.report_events) + if (self.event.action == .release and !self.kitty_flags.report_events) return ""; const all_mods = self.event.mods; @@ -737,6 +737,23 @@ test "kitty: plain text" { try testing.expectEqualStrings("abcd", actual); } +test "kitty: repeat with just disambiguate" { + var buf: [128]u8 = undefined; + var enc: KeyEncoder = .{ + .event = .{ + .key = .a, + .action = .repeat, + .mods = .{}, + .utf8 = "a", + }, + + .kitty_flags = .{ .disambiguate = true }, + }; + + const actual = try enc.kitty(&buf); + try testing.expectEqualStrings("a", actual); +} + test "kitty: enter, backspace, tab" { var buf: [128]u8 = undefined; {