diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index 28afbdd36..5b55462d4 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -2716,7 +2716,9 @@ fn keyboard(app: &mut SheetApp, ctx: &egui::Context, resp: &egui::Response, geo: } Key::F9 => app.run_or_alert("formulas.calculateNow", json!({})), Key::F4 if !cmd => {} - _ if cmd => crate::ribbon::shortcut(app, key, m), + _ if cmd && !crate::keymap::altgr_text(ctx, m, ctx.os() == egui::os::OperatingSystem::Mac) => { + crate::ribbon::shortcut(app, key, m) + } _ => {} } } diff --git a/crates/ui-egui/src/keymap.rs b/crates/ui-egui/src/keymap.rs index 032db1a2d..92f7093d7 100644 --- a/crates/ui-egui/src/keymap.rs +++ b/crates/ui-egui/src/keymap.rs @@ -162,12 +162,16 @@ pub fn lookup(key: Key, physical: Option, m: Modifiers, mac: bool) -> Optio }) } +/// AltGr arrives as Ctrl+Alt on Windows: a key that also typed a character (AltGr+= is `~` on a German +/// layout; a user-defined Ctrl+Alt+A hotkey may type `ä`) is text, not a shortcut. +pub(crate) fn altgr_text(ctx: &egui::Context, m: Modifiers, mac: bool) -> bool { + !mac && m.alt && m.ctrl && ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Text(_)))) +} + /// Handles a key press in the grid. Returns whether it was a shortcut. pub(crate) fn dispatch(app: &mut SheetApp, ctx: &egui::Context, key: Key, physical: Option, m: Modifiers, geo: &Geo, sh: &Sheet) -> bool { let mac = ctx.os() == egui::os::OperatingSystem::Mac; - // AltGr arrives as Ctrl+Alt on Windows: a key that also typed a character (AltGr+= is `~` - // on a German layout) is text, not a shortcut. - if !mac && m.alt && m.ctrl && ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Text(_)))) { + if altgr_text(ctx, m, mac) { return false; } let Some(shortcut) = lookup(key, physical, m, mac) else { return false }; diff --git a/crates/ui-egui/tests/keyboard_shortcuts.rs b/crates/ui-egui/tests/keyboard_shortcuts.rs index 78bc966f5..d87f31ad5 100644 --- a/crates/ui-egui/tests/keyboard_shortcuts.rs +++ b/crates/ui-egui/tests/keyboard_shortcuts.rs @@ -247,3 +247,14 @@ fn alt_equals_autosum_does_not_also_type_the_equals_sign() { alt_equals(&mut h); assert_eq!(h.state().editor.as_ref().map(|e| e.text.clone()).as_deref(), Some("=SUM()")); } + +#[test] +fn ctrl_alt_letter_that_typed_text_is_not_select_all() { + let mut h = harness(book("B2")); + let ctrl_alt = Modifiers { alt: true, ..CTRL }; + h.input_mut().events.push(Event::Key { key: Key::A, physical_key: Some(Key::A), pressed: true, repeat: false, modifiers: ctrl_alt }); + h.input_mut().events.push(Event::Text("\u{e4}".into())); + h.run_steps(2); + assert_eq!(h.state().session.active().unwrap().selection.current().a1(), "B2"); + assert_eq!(h.state().editor.as_ref().unwrap().text, "\u{e4}"); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index aaa6a0e82..709d73da9 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -130,7 +130,8 @@ otherwise. Number-format and border keys match the physical key (Ctrl+Shift+4, w | — | Cmd+= (calculate), Cmd+T (references while editing; F4 works), Shift+F7, Cmd+Shift+L | Mac-only extras | missing (Cmd+= is egui's zoom key; no thesaurus or Modify Cell Style) | On Windows, AltGr arrives as Ctrl+Alt: a Ctrl+Alt key that also types a character is treated as -text, so AltGr symbols (e.g. `~` on a German layout) never trigger a shortcut. +text, so AltGr symbols (e.g. `~` on a German layout) and user-defined Ctrl+Alt+letter hotkeys that type +a character (e.g. Ctrl+Alt+A for `ä`) never trigger a shortcut, Ctrl+letter ones like Select All included. ## Dialogs @@ -166,6 +167,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. | 2026-10-18 | minor | Keytip letters typed with left Alt held continue the sequence (Alt+H, O, A / Alt+H, O, I ran nothing before: Alt+letter cancelled keytips); other Alt combinations, AltGr and macOS Option are unchanged (#1846) | | 2026-10-13 | minor | AutoFill month patterns retain the workbook's date system, preventing shifted dates in 1904 workbooks when filling forward or backward | | 2026-10-16 | minor | Ctrl+Shift+A (Control+Shift+A on a Mac) after a function name, or after its `(`, inserts the argument names and the closing parenthesis, as in Excel; one Undo in the editor takes them back | +| 2026-10-17 | minor | A Ctrl+Alt+letter key that types a character (a user-defined Windows hotkey such as Ctrl+Alt+A for `ä`) types it instead of running the Ctrl+letter shortcut, e.g. Select All (#1530) | | 2026-10-12 | minor | The File view's recent list tells when each workbook was last changed, read off the UI thread | | 2026-10-13 | minor | Horizontal scrollbar in the sheet tab bar: drag, track click pages, frozen columns excluded from the page (#840) | | 2026-10-12 | minor | Ctrl+wheel zoom steps along a ladder of percentages about 20% apart that never skips 100%, gliding to each step with animations on, so a notch out undoes a notch in (it drifted: 100 → 122 → 101); Excel steps 15 points, see decisions.md |