From 99b3e2e844a4064e21728335e73834321efbd18f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 19 Aug 2024 12:33:21 -0700 Subject: [PATCH] core: clear pending keyboard sequence when config reloads --- src/Surface.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Surface.zig b/src/Surface.zig index 587837aed..160d24de9 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -889,6 +889,13 @@ fn changeConfig(self: *Surface, config: *const configpkg.Config) !void { self.showMouse(); } + // If we are in the middle of a key sequence, clear it. + self.keyboard.bindings = null; + if (self.keyboard.queued.items.len > 0) { + for (self.keyboard.queued.items) |req| req.deinit(); + self.keyboard.queued.clearAndFree(self.alloc); + } + // Before sending any other config changes, we give the renderer a new font // grid. We could check to see if there was an actual change to the font, // but this is easier and pretty rare so it's not a performance concern.