Chat quick switcher MRU, Closed section and markers; Alt+N, Alt+J and run tab keys

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>
This commit is contained in:
2026-12-03 00:49:36 +00:00
parent accb9970b6
commit 12c7642e35
25 changed files with 1223 additions and 46 deletions
+30 -1
View File
@@ -12,6 +12,7 @@ import 'shell_navigation_bar.dart';
import 'shell_rail_scope.dart';
import 'list_pane_widths.dart';
import 'shell_bar.dart';
import 'shell_chat_actions_shortcut.dart';
import 'shell_chat_shortcut.dart';
import 'shell_cheatsheet.dart';
import 'shell_cheatsheet_shortcut.dart';
@@ -33,6 +34,7 @@ class AdaptiveShell extends StatefulWidget {
this.onSearch,
this.onOpenChat,
this.onChatQuickSwitch,
this.onChatAction,
this.attentionCount = 0,
this.runningRunCount,
this.listPaneWidthStore = const SharedPreferencesListPaneWidthStore(),
@@ -77,6 +79,11 @@ class AdaptiveShell extends StatefulWidget {
/// the composer focus of [onOpenChat] there too.
final VoidCallback? onChatQuickSwitch;
/// Runs after Alt+N or Alt+J (see [shellChatActionShortcut]) has shown the
/// Chat destination: the host starts a new chat or opens the next chat
/// needing the operator. Null leaves both chords unhandled.
final ValueChanged<ShellChatAction>? onChatAction;
/// Runs needing the operator today, retained in the tab's accessible label.
final int attentionCount;
@@ -410,8 +417,20 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
}
return true;
}
// A terminal keeps its keys (Escape, Ctrl+/, Ctrl+digits).
// A terminal keeps its keys (Escape, Ctrl+/, Ctrl+digits, Alt+N, Alt+J).
if (primaryFocusIsTypingSurface()) return false;
final chatAction = widget.onChatAction == null
? null
: shellChatActionShortcut(event, keyboard);
if (chatAction != null) {
// A dialog or popup over the shell keeps its keys.
if (!_shellRouteHasKeyboard()) return false;
if (event is KeyDownEvent) {
if (_selected != AppDestination.chat) _select(AppDestination.chat);
widget.onChatAction!(chatAction);
}
return true;
}
if (_selected == AppDestination.search &&
event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.escape &&
@@ -450,6 +469,16 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
widget.onOpenChat?.call();
}
/// Whether the keyboard is outside any dialog, sheet or menu (a page, such
/// as a phone's open chat, is fine).
bool _shellRouteHasKeyboard() {
final focusedContext = FocusManager.instance.primaryFocus?.context;
final focusedRoute = focusedContext == null
? null
: ModalRoute.of(focusedContext);
return focusedRoute is! PopupRoute;
}
/// A popup or nested viewer owns Escape before the underlying Search tab.
bool _searchEscape() {
final route = ModalRoute.of(context);