diff --git a/input-emulation/src/macos.rs b/input-emulation/src/macos.rs index b1f6688..282bf5e 100644 --- a/input-emulation/src/macos.rs +++ b/input-emulation/src/macos.rs @@ -106,14 +106,19 @@ impl MacOSEmulation { } } } - // release key when cancelled. + // Always release the key with the correct CGKeyCode, regardless of + // whether the repeat loop ran. This matches @feschber's review + // request: "still release the key repeat task but with the correct + // code." + // // Do NOT call update_modifiers here: `key` is a Mac CGKeyCode but // update_modifiers expects a Linux evdev scancode, and the two // codespaces collide (e.g. Mac LeftShift=56 == Linux KeyLeftAlt=56, // Mac Down=125 == Linux KeyLeftMeta=125), corrupting modifier // state for chords like Shift+Option+X or Cmd+Down. Modifier state - // is owned by the main consume() loop, which calls update_modifiers - // with the correct Linux scancode on the real release event. + // is owned by the main consume() loop, which already calls + // update_modifiers with the correct Linux scancode on the real key + // release event from the client. key_event(event_source.clone(), key, 0, modifiers.get()); }); self.repeat_task = Some(repeat_task);