From aa8329460d42be9bcf6f92a2d49632dc0469004a Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 19:33:17 +0000 Subject: [PATCH] Open Search with Alt slash shortcut Accept the physical slash key for exact Alt+/ delivery, including macOS Option dead-key values, while preserving existing Ctrl+/ and Command+/ behavior. Add focused regression coverage and document the verified checks. --- app/lib/shell/shell_list_shortcuts.dart | 11 +++++--- app/notes/open-search-alt-slash.md | 14 ++++++++++ app/test/shell/search_shortcuts_test.dart | 32 +++++++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 app/notes/open-search-alt-slash.md diff --git a/app/lib/shell/shell_list_shortcuts.dart b/app/lib/shell/shell_list_shortcuts.dart index 45751f3a..503c2e35 100644 --- a/app/lib/shell/shell_list_shortcuts.dart +++ b/app/lib/shell/shell_list_shortcuts.dart @@ -61,10 +61,13 @@ bool shellSearchShortcut( TargetPlatform? platform, }) => event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.slash && - shellPrimaryModifier(keyboard, platform: platform) && - !keyboard.isAltPressed && - !keyboard.isShiftPressed; + !keyboard.isShiftPressed && + (shellPrimaryModifier(keyboard, platform: platform) + ? !keyboard.isAltPressed && event.logicalKey == LogicalKeyboardKey.slash + : keyboard.isAltPressed && + !keyboard.isControlPressed && + !keyboard.isMetaPressed && + event.physicalKey == PhysicalKeyboardKey.slash); const _digits = [ LogicalKeyboardKey.digit1, diff --git a/app/notes/open-search-alt-slash.md b/app/notes/open-search-alt-slash.md new file mode 100644 index 00000000..33729489 --- /dev/null +++ b/app/notes/open-search-alt-slash.md @@ -0,0 +1,14 @@ +# Open Search with Alt+/ and Command+/ + +- Updated `shellSearchShortcut` to accept an exact Alt+/ chord by physical + slash position, including macOS Option dead-key logical values. +- Existing Ctrl+/ and macOS Command+/ matching remains logical-slash based; + Shift and mixed/extra modifiers remain rejected. +- Search destination routing, focus, query retention, and composer drafts were + left unchanged. +- Focused checks: `tool/memwatch/full.sh 'test/shell/search_shortcuts_test.dart + test/shell/destination_shortcuts_test.dart test/shell/list_shortcuts_test.dart'` + — PASS (10 passed, 0 failed, 0 skipped). +- `tool/analyze.sh` — clean. +- Browser capture was not run in this implementation stage; UI review owns + full-app Alt+/ and Meta+/ interaction evidence. diff --git a/app/test/shell/search_shortcuts_test.dart b/app/test/shell/search_shortcuts_test.dart index e788a6fa..8dcb31e7 100644 --- a/app/test/shell/search_shortcuts_test.dart +++ b/app/test/shell/search_shortcuts_test.dart @@ -75,6 +75,27 @@ void main() { }); } + test('Alt+/ uses the physical slash key for Option dead-key delivery', () { + const event = KeyDownEvent( + physicalKey: PhysicalKeyboardKey.slash, + logicalKey: LogicalKeyboardKey(0x00BF), + character: '¿', + timeStamp: Duration.zero, + ); + expect(shellSearchShortcut(event, _AltHeld()), isTrue); + expect( + shellSearchShortcut( + const KeyUpEvent( + physicalKey: PhysicalKeyboardKey.slash, + logicalKey: LogicalKeyboardKey(0x00BF), + timeStamp: Duration.zero, + ), + _AltHeld(), + ), + isFalse, + ); + }); + for (final platform in [TargetPlatform.macOS, TargetPlatform.windows]) { testWidgets( 'Search chord opens and refocuses retained query on $platform', @@ -130,3 +151,14 @@ void main() { ); } } + +class _AltHeld extends HardwareKeyboard { + @override + bool get isAltPressed => true; + @override + bool get isControlPressed => false; + @override + bool get isMetaPressed => false; + @override + bool get isShiftPressed => false; +}