12c7642e35
Ctrl+K lists open chats most recently used first (tracked on open and pane focus, persisted per server) and preselects the previous chat, so Ctrl+K, Enter returns to it. Rows mark needs you / working / unread; a query also lists matching closed chats under Closed, and choosing one reopens it. Alt+N (Option+N) starts a new chat and Alt+J (Option+J) opens the next chat waiting for you, unread or failed, cycling; the terminal keeps both. In run detail, bare 1-4 switch tabs when not typing. Cheatsheet entries added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.4 KiB
Dart
41 lines
1.4 KiB
Dart
import 'package:flutter/services.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
import '../../../ui/input/keyboard_owner.dart';
|
|
|
|
const _digits = [
|
|
LogicalKeyboardKey.digit1,
|
|
LogicalKeyboardKey.digit2,
|
|
LogicalKeyboardKey.digit3,
|
|
LogicalKeyboardKey.digit4,
|
|
LogicalKeyboardKey.numpad1,
|
|
LogicalKeyboardKey.numpad2,
|
|
LogicalKeyboardKey.numpad3,
|
|
LogicalKeyboardKey.numpad4,
|
|
];
|
|
|
|
/// The 0-based run-detail tab a bare 1…4 key press names, or null. Any
|
|
/// modifier (Ctrl+1…9 opens a chat list item) or a repeat is not the key.
|
|
int? runDetailTabDigit(KeyEvent event, HardwareKeyboard keyboard) {
|
|
if (event is! KeyDownEvent ||
|
|
keyboard.isControlPressed ||
|
|
keyboard.isMetaPressed ||
|
|
keyboard.isAltPressed ||
|
|
keyboard.isShiftPressed) {
|
|
return null;
|
|
}
|
|
final index = _digits.indexOf(event.logicalKey);
|
|
return index < 0 ? null : index % 4;
|
|
}
|
|
|
|
/// Whether a digit pressed now is meant for the run detail at [context]: it
|
|
/// is on screen (not in a hidden destination or tab), no dialog, menu or
|
|
/// visit page is over it, and nothing that takes typing (a text field, the
|
|
/// terminal) has the keyboard.
|
|
bool runDetailOwnsDigits(BuildContext context) {
|
|
if (!TickerMode.valuesOf(context).enabled) return false;
|
|
final route = ModalRoute.of(context);
|
|
if (route != null && !route.isCurrent) return false;
|
|
return !primaryFocusTakesTyping();
|
|
}
|