From a94d1cfd17da6df24b95f3e8a8d1fa9a9726c059 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Mon, 28 Sep 2026 18:47:17 +0300 Subject: [PATCH] fix(input): AltGr and macOS Option characters type into the command line Windows reports AltGr as Ctrl+Alt, so '@' and similar layout glyphs were treated as shortcuts and dropped; polar input like @10<45 failed. Fixes #1236 Co-Authored-By: Claude Opus 5.5 --- src/app/view/mod.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/app/view/mod.rs b/src/app/view/mod.rs index 95e99ee72..0c75a7a34 100644 --- a/src/app/view/mod.rs +++ b/src/app/view/mod.rs @@ -2658,8 +2658,25 @@ impl OpenCADStudio { }) => { #[cfg(target_arch = "wasm32")] let accel = modifiers.command(); - let shortcut_modifier = - modifiers.control() || modifiers.alt() || modifiers.logo(); + // AltGr reaches Windows apps as Ctrl+Alt, and a macOS + // layout types some characters with Option: when such a + // chord produces a printable glyph (`@`, `<`, `{` on many + // European layouts) it is typing, not a shortcut. (#1236) + let types_glyph = text.as_deref().is_some_and(|value| { + !value.is_empty() + && value + .chars() + .all(|ch| !ch.is_control() && !ch.is_whitespace()) + }); + let altgr = modifiers.control() && modifiers.alt(); + let mac_option = cfg!(target_os = "macos") + && modifiers.alt() + && !modifiers.control() + && !modifiers.logo(); + let shortcut_modifier = (modifiers.control() + || modifiers.alt() + || modifiers.logo()) + && !(types_glyph && (altgr || mac_option)); // Any key that produces a printable glyph types it, // even when its logical key resolves to navigation // (NumLock-on Numpad8 / Numpad2 arrive as