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.
This commit is contained in:
@@ -61,10 +61,13 @@ bool shellSearchShortcut(
|
|||||||
TargetPlatform? platform,
|
TargetPlatform? platform,
|
||||||
}) =>
|
}) =>
|
||||||
event is KeyDownEvent &&
|
event is KeyDownEvent &&
|
||||||
event.logicalKey == LogicalKeyboardKey.slash &&
|
!keyboard.isShiftPressed &&
|
||||||
shellPrimaryModifier(keyboard, platform: platform) &&
|
(shellPrimaryModifier(keyboard, platform: platform)
|
||||||
!keyboard.isAltPressed &&
|
? !keyboard.isAltPressed && event.logicalKey == LogicalKeyboardKey.slash
|
||||||
!keyboard.isShiftPressed;
|
: keyboard.isAltPressed &&
|
||||||
|
!keyboard.isControlPressed &&
|
||||||
|
!keyboard.isMetaPressed &&
|
||||||
|
event.physicalKey == PhysicalKeyboardKey.slash);
|
||||||
|
|
||||||
const _digits = [
|
const _digits = [
|
||||||
LogicalKeyboardKey.digit1,
|
LogicalKeyboardKey.digit1,
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -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]) {
|
for (final platform in [TargetPlatform.macOS, TargetPlatform.windows]) {
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Search chord opens and refocuses retained query on $platform',
|
'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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user