mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-23 20:26:09 +03:00
apprt/embedded: initialize unmodified keystate prior to use
Fixes #521 We were not initializing the dead key state. The dead key state is read on all translation calls so it must be initialized to 0. This was working before because coincidentally whatever the memory was always worked (it probably didn't, but it never didn't work for someone to notice). In debug modes, Zig sets uninitialized memory to 0xAAAAAAAA. Amusingly, this is a valid dead key state value that UCKeyTranslate ignores and thus produces the correct value. Therefore, we were only seeing bugs in release modes where the uninitialized memory was a bad value (consistently 0x1 on my machine) causing the wrong key to come out. We were getting lucky before, this has always been a bug.
This commit is contained in:
@ -557,7 +557,7 @@ pub const Surface = struct {
|
||||
// order to get the "unshifted_codepoint" for the key event.
|
||||
const unshifted_codepoint: u21 = unshifted: {
|
||||
var nomod_buf: [128]u8 = undefined;
|
||||
var nomod_state: input.Keymap.State = undefined;
|
||||
var nomod_state: input.Keymap.State = .{};
|
||||
const nomod = try self.app.keymap.translate(
|
||||
&nomod_buf,
|
||||
&nomod_state,
|
||||
|
Reference in New Issue
Block a user