Reserve global shortcuts for chat selection and search
This commit is contained in:
@@ -273,34 +273,24 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
if (previous != null) _select(previous);
|
||||
}
|
||||
|
||||
/// Handles this before focused text controls can insert or traverse on
|
||||
/// Ctrl+Tab. The handler is scoped to the shell's lifetime, not onboarding.
|
||||
///
|
||||
/// Ctrl+1…Ctrl+9 open the Nth item of the open tab's list the same way, in
|
||||
/// the list's on-screen order; a page (Settings) has no list.
|
||||
/// App-wide search and conversation-list selection are handled before text
|
||||
/// fields. Split-pane navigation belongs to the chat workspace; tab changes
|
||||
/// have no global keyboard chord.
|
||||
bool _handleDestinationKeyEvent(KeyEvent event) {
|
||||
final listIndex = shellListShortcutIndex(
|
||||
event,
|
||||
HardwareKeyboard.instance,
|
||||
);
|
||||
if (listIndex != null) {
|
||||
if (!shellTabDestinations.contains(_selected)) return false;
|
||||
return _bar.lists.open(_selected, listIndex);
|
||||
final keyboard = HardwareKeyboard.instance;
|
||||
if (shellSearchShortcut(event, keyboard)) {
|
||||
_select(AppDestination.search);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && _selected == AppDestination.search) {
|
||||
_bar.searchFocus.request();
|
||||
}
|
||||
});
|
||||
WidgetsBinding.instance.ensureVisualUpdate();
|
||||
return true;
|
||||
}
|
||||
if (event is! KeyDownEvent ||
|
||||
event.logicalKey != LogicalKeyboardKey.tab ||
|
||||
!HardwareKeyboard.instance.isControlPressed) {
|
||||
return false;
|
||||
}
|
||||
final current = shellTabDestinations.indexOf(shellTabFor(_selected));
|
||||
final direction = HardwareKeyboard.instance.isShiftPressed ? -1 : 1;
|
||||
final next = (current + direction) % shellTabDestinations.length;
|
||||
_select(
|
||||
shellTabDestinations[next < 0
|
||||
? next + shellTabDestinations.length
|
||||
: next],
|
||||
);
|
||||
return true;
|
||||
final listIndex = shellListShortcutIndex(event, keyboard);
|
||||
if (listIndex == null || _selected != AppDestination.chat) return false;
|
||||
return _bar.lists.open(AppDestination.chat, listIndex);
|
||||
}
|
||||
|
||||
List<FloatingDestinationItem> _destinationItems() =>
|
||||
|
||||
Reference in New Issue
Block a user