Rebind chat file and center-stage shortcuts

Give Cmd/Ctrl+E to the active chat Files panel while preserving terminal behavior, and move Center Stage to the shifted chord. Update shortcut documentation and regression coverage for the new bindings.
This commit is contained in:
2026-11-12 19:52:39 +00:00
parent 19b1d1326a
commit 3029295b1f
15 changed files with 382 additions and 52 deletions
@@ -25,6 +25,7 @@ class ChatPanePlacement {
this.ownsPasteWhenFocused = false,
this.paneControls,
this.paneCommands,
this.onComposerFocus,
this.onNextChat,
});
@@ -55,6 +56,7 @@ class ChatPanePlacement {
/// Choices the chat list hands to this chat's conversation to run.
final ChatPaneCommands? paneCommands;
final VoidCallback? onComposerFocus;
final VoidCallback? onNextChat;
}
@@ -115,6 +117,7 @@ Widget buildChatPaneContent({
showBackButton: placement.showBackButton,
paneControls: placement.paneControls?.call(context) ?? const [],
paneCommands: placement.paneCommands,
onComposerFocus: placement.onComposerFocus,
),
),
),
@@ -20,6 +20,7 @@ String _paneMoveLabel(ChatPaneDirection direction) => switch (direction) {
/// own handler for the row's chat, which is opened first.
mixin _ChatScreenPaneMenu on State<ChatScreen>, _ChatScreenWorkspace
implements SessionPaneMenu {
@override
ChatPaneCommands get _paneCommands;
void _openBySelection(JsonMap session);
@@ -4,6 +4,7 @@ part of 'screen.dart';
mixin _ChatScreenWorkspace on State<ChatScreen> {
Map<String, JsonMap> get _openedSessions;
ChatComposerFocusRequests get _composerFocus;
ChatPaneCommands get _paneCommands;
bool _chatOwnsKeyboard();
JsonMap? _rowFor(String id);
void _back();
@@ -443,6 +444,10 @@ mixin _ChatScreenWorkspace on State<ChatScreen> {
top: false,
child: ChatCenterStageKeys(
controller: ChatCenterStageController.instance,
onToggleFiles: () {
final id = _workspace.activePane?.sessionId;
if (id != null) _paneCommands.request(id, ChatPaneCommand.files);
},
enabled: () =>
_workspaceVisible &&
_workspace.paneCount > 0 &&
@@ -121,6 +121,7 @@ class ChatThreadView extends StatefulWidget {
this.onNextChat,
this.paneControls = const [],
this.paneCommands,
this.onComposerFocus,
this.sidebarControl,
this.showBackButton,
this.useNativeBack = false,
@@ -136,6 +137,7 @@ class ChatThreadView extends StatefulWidget {
/// The chat list's requests for this chat, run as the More menu runs them.
final ChatPaneCommands? paneCommands;
final VoidCallback? onComposerFocus;
final Widget? sidebarControl;
final bool? showBackButton;
final bool useNativeBack;
@@ -340,6 +342,11 @@ class _ChatThreadViewState extends State<ChatThreadView> {
final next = !_filesVisible;
if (!mounted) return;
setState(() => _filesVisible = next);
if (!next) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) widget.onComposerFocus?.call();
});
}
_reportCenterStageFilesWidth();
unawaited(_filesPreferences.setVisible(next));
if (next && MediaQuery.sizeOf(context).width < 700) _openFilesSheet();
@@ -116,6 +116,7 @@ class FilesHeader extends StatelessWidget {
Expanded(
child: TextField(
controller: filter,
autofocus: true,
onChanged: controller.setFilter,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.search),
+1
View File
@@ -424,6 +424,7 @@ class _ChatScreenState extends State<ChatScreen>
pasteTarget: _workspaceVisible && pane.id == _workspace.activePaneId,
showBackButton: _page.open || !showsListBesideDetail(context),
paneCommands: _paneCommands,
onComposerFocus: () => _composerFocus.request(selected),
paneControls: (paneContext) => [
ChatBarAction(
label: 'Add chat pane',
@@ -1,14 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../../shell/windows/window_entry.dart';
import '../../../ui/adaptive/window_margins.dart';
import '../../../ui/input/keyboard_owner.dart';
import '../chat_pane_content.dart';
import '../workspace/chat_center_stage_controller.dart';
import '../workspace/chat_pane_commands.dart';
import 'chat_window_tabs.dart';
import 'chat_windows.dart';
/// A floating window's chat: the same live view as a tiled pane (see
/// [buildChatPaneContent]), with what a window decides. Before the server
/// has been reached it says so instead of reading a chat.
class ChatWindowContent extends StatelessWidget {
class ChatWindowContent extends StatefulWidget {
const ChatWindowContent({
super.key,
required this.windows,
@@ -18,25 +23,59 @@ class ChatWindowContent extends StatelessWidget {
final ChatWindows windows;
final WindowEntry entry;
@override
State<ChatWindowContent> createState() => _ChatWindowContentState();
}
class _ChatWindowContentState extends State<ChatWindowContent> {
final _paneCommands = ChatPaneCommands();
@override
void initState() {
super.initState();
FocusManager.instance.addEarlyKeyEventHandler(_key);
}
@override
void dispose() {
FocusManager.instance.removeEarlyKeyEventHandler(_key);
_paneCommands.dispose();
super.dispose();
}
KeyEventResult _key(KeyEvent event) {
final scope = keyboardWindow();
final keyboard = HardwareKeyboard.instance;
if (scope?.entry.id != widget.entry.id ||
!chatFilesShortcut(event, keyboard) ||
primaryFocusIsTypingSurface()) {
return KeyEventResult.ignored;
}
if (event is KeyDownEvent) {
_paneCommands.request(widget.entry.contentId, ChatPaneCommand.files);
}
return KeyEventResult.handled;
}
@override
Widget build(BuildContext context) {
final runtime = windows.runtime;
final sessionId = entry.contentId;
final runtime = widget.windows.runtime;
final sessionId = widget.entry.contentId;
return ListenableBuilder(
listenable: Listenable.merge([
runtime,
runtime.syncToken,
windows.readiness,
widget.windows.readiness,
]),
builder: (context, _) {
// A chat is drawn once: the tiling wins, and this window closes.
if (windows.tiling?.holds(sessionId) ?? false) {
if (widget.windows.tiling?.holds(sessionId) ?? false) {
WidgetsBinding.instance.addPostFrameCallback(
(_) => windows.manager.close(entry.id),
(_) => widget.windows.manager.close(widget.entry.id),
);
return const SizedBox.shrink();
}
if (!windows.ready) {
if (!widget.windows.ready) {
return Center(
child: Text(
'Connecting…',
@@ -56,9 +95,17 @@ class ChatWindowContent extends StatelessWidget {
// Never the active pane: its composer takes a paste while it
// has the keyboard.
ownsPasteWhenFocused: true,
onNewSession: (previousId, session, notice) => windows
.startedNewSession(entry.id, previousId, session, notice),
onSessionClosed: () => windows.sessionClosed(entry.id),
paneCommands: _paneCommands,
onComposerFocus: () => runtime.composerFocus.request(sessionId),
onNewSession: (previousId, session, notice) =>
widget.windows.startedNewSession(
widget.entry.id,
previousId,
session,
notice,
),
onSessionClosed: () =>
widget.windows.sessionClosed(widget.entry.id),
),
),
);
@@ -72,8 +72,7 @@ class ChatCenterStageController extends ValueNotifier<bool> {
}
/// Whether [event] toggles center stage: Alt+E (Option+E on Apple platforms),
/// Cmd+E on Apple platforms (where Ctrl+E stays the text fields' and shell's
/// end of line), and Ctrl+E elsewhere. Option+E is recognized by physical key
/// or the shifted primary chord. Option+E is recognized by physical key
/// position because macOS delivers it as a dead-key logical value. Repeats of
/// a held chord match too, so they are swallowed; only the first press toggles.
bool chatCenterStageShortcut(
@@ -81,16 +80,39 @@ bool chatCenterStageShortcut(
HardwareKeyboard keyboard, {
TargetPlatform? platform,
}) {
if (event is KeyUpEvent || keyboard.isShiftPressed) {
if (event is KeyUpEvent) {
return false;
}
final alt = keyboard.isAltPressed;
if (alt) {
return event.physicalKey == PhysicalKeyboardKey.keyE &&
!keyboard.isShiftPressed &&
!keyboard.isControlPressed &&
!keyboard.isMetaPressed;
}
if (event.logicalKey != LogicalKeyboardKey.keyE) return false;
if (event.physicalKey != PhysicalKeyboardKey.keyE) return false;
return chatCenterStageUsesCommand(platform)
? keyboard.isShiftPressed &&
keyboard.isMetaPressed &&
!keyboard.isControlPressed
: keyboard.isShiftPressed &&
keyboard.isControlPressed &&
!keyboard.isMetaPressed;
}
/// Whether [event] is the Files toggle chord. It deliberately leaves Ctrl+E
/// to a terminal on every platform; macOS uses Cmd+E for the app shortcut.
bool chatFilesShortcut(
KeyEvent event,
HardwareKeyboard keyboard, {
TargetPlatform? platform,
}) {
if (event is KeyUpEvent ||
event.physicalKey != PhysicalKeyboardKey.keyE ||
keyboard.isShiftPressed ||
keyboard.isAltPressed) {
return false;
}
return chatCenterStageUsesCommand(platform)
? keyboard.isMetaPressed && !keyboard.isControlPressed
: keyboard.isControlPressed && !keyboard.isMetaPressed;
@@ -4,12 +4,15 @@ import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import '../../../ui/input/keyboard_owner.dart';
import '../windows/chat_window_tabs.dart';
import 'chat_center_stage_controller.dart';
void _ignoreFilesShortcut() {}
/// Answers the center-stage chord before any focused widget sees it, so it
/// works from the composer, the sidebar or a toolbar, and the focused field
/// never types it. Handling the key also stops a browser's own Ctrl+E/Cmd+E
/// (address-bar search, find with selection) in the web build.
/// never types it. Handling the app-owned chords also stops a browser's own
/// shortcut behavior in the web build.
///
/// Alt+E/Option+E works everywhere, including while a composer is focused.
/// On Apple platforms Cmd+E works in the terminal too. Elsewhere Ctrl+E is
@@ -20,6 +23,7 @@ class ChatCenterStageKeys extends StatefulWidget {
super.key,
required this.controller,
required this.enabled,
this.onToggleFiles = _ignoreFilesShortcut,
required this.child,
});
@@ -28,6 +32,7 @@ class ChatCenterStageKeys extends StatefulWidget {
/// Whether the chord belongs to this workspace now: wide, shown and with
/// no popup or other destination over it.
final bool Function() enabled;
final VoidCallback onToggleFiles;
final Widget child;
@override
@@ -49,12 +54,21 @@ class _ChatCenterStageKeysState extends State<ChatCenterStageKeys> {
}
KeyEventResult _key(KeyEvent event) {
if (!mounted ||
!chatCenterStageShortcut(event, HardwareKeyboard.instance) ||
!widget.enabled() ||
(!HardwareKeyboard.instance.isAltPressed &&
!chatCenterStageUsesCommand() &&
primaryFocusIsTypingSurface())) {
if (!mounted || !widget.enabled()) return KeyEventResult.ignored;
final keyboard = HardwareKeyboard.instance;
if (chatFilesShortcut(event, keyboard)) {
// A floating chat owns the command when its focused node is inside its
// WindowScope; its own early handler will route it to that chat.
if (keyboardWindow() != null) return KeyEventResult.ignored;
// Editable chat fields are still app-owned for this chord. A terminal
// is the exception: Ctrl+E must remain its shell end-of-line command.
if (primaryFocusIsTypingSurface()) return KeyEventResult.ignored;
if (event is KeyDownEvent) {
widget.onToggleFiles();
}
return KeyEventResult.handled;
}
if (!chatCenterStageShortcut(event, keyboard)) {
return KeyEventResult.ignored;
}
if (event is KeyDownEvent) widget.controller.toggle();
@@ -125,11 +125,16 @@ class KeyboardShortcutRegistry {
caveat:
'While the slash command list is open above the composer. Esc dismisses it.',
),
KeyboardShortcutEntry(
group: KeyboardShortcutGroup.chat,
action: 'Toggle Files',
keys: _apple ? 'Cmd+E' : 'Ctrl+E',
),
KeyboardShortcutEntry(
group: KeyboardShortcutGroup.chat,
action: 'Toggle Center Stage',
keys:
'${chatCenterStageShortcutLabel(platform)}${_apple ? ', Cmd+E' : ', Ctrl+E'}',
'${chatCenterStageShortcutLabel(platform)}${_apple ? ', Cmd+Shift+E' : ', Ctrl+Shift+E'}',
),
const KeyboardShortcutEntry(
group: KeyboardShortcutGroup.chat,
+22
View File
@@ -0,0 +1,22 @@
# Ctrl+E Files and Center Stage shortcuts
Implemented the chat shortcut rebind:
- Cmd+E on Apple platforms, or Ctrl+E elsewhere, routes to the active chat's
Files toggle; terminal typing surfaces keep Ctrl+E.
- Ctrl+Shift+E / Cmd+Shift+E toggles Center Stage; Alt+E / Option+E remains a
Center Stage shortcut.
- The same Files command is handled by focused floating chat windows.
- Opening Files autofocuses its filter field, and the registry lists both
shortcuts with platform-specific labels.
Focused verification:
`tool/memwatch/full.sh 'test/features/chat/workspace/chat_center_stage_test.dart test/features/settings/keyboard_shortcuts_cheatsheet_test.dart test/features/chat/chat_split_integration_test.dart test/features/chat/chat_floating_pane_test.dart test/shell/detail_page_close_test.dart'` — 62 passed.
`tool/analyze.sh`: clean.
The retry also corrected physical-key matching for both chords, leaves the
Files shortcut available from an editable composer while preserving terminal
Ctrl+E, restores composer focus after closing Files, and prevents the tiled
handler from intercepting a focused floating chat's Files command.
@@ -31,11 +31,22 @@ class _Gateway extends FakeChatGateway {
if (type == 'chat_sessions') {
return Future.value({
'chat_sessions': [
for (final id in ['a', 'b', 'c']) {'id': id, 'title': 'Chat $id'},
for (final id in ['a', 'b', 'c'])
{'id': id, 'title': 'Chat $id', 'directory': '/home/$id'},
],
});
}
if (type == 'chat_shells') return Future.value({'chat_shells': []});
if (type == 'directory_listing') {
final path = '${fields['path'] ?? '/home/a'}';
return Future.value({
'directory_listing': {
'path': path,
'home': '/home/a',
'entries': <JsonMap>[],
},
});
}
return super.call(type, fields);
}
}
@@ -334,6 +345,27 @@ void main() {
await app.stop(tester);
});
testWidgets('Ctrl+E opens Files in the focused floating chat', (
tester,
) async {
await _saved('a', 'b');
final app = _App(_Store());
await app.start(tester);
await _menu(tester, 'b', 'Float (Alt+Y)');
await tester.tap(_input('b'));
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pumpAndSettle();
expect(find.byType(FilesPanel), findsOneWidget);
await tester.tap(_shown('Chat b'));
expect(tester.takeException(), isNull);
await tester.pump(const Duration(milliseconds: 100));
await app.stop(tester);
});
testWidgets('the last tiled chat floats and leaves the tiling empty', (
tester,
) async {
@@ -7,6 +7,7 @@ import 'package:pipelines_app/features/chat/screen.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import 'package:pipelines_app/features/chat/files/files_panel.dart';
import 'package:pipelines_app/features/chat/ui/sessions/session_actions.dart';
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
@@ -18,10 +19,23 @@ class _Gateway extends FakeChatGateway {
if (type == 'chat_sessions') {
return Future.value({
'chat_sessions': [
for (final id in ['a', 'b', 'c']) {'id': id, 'title': 'Chat $id'},
for (final id in ['a', 'b', 'c'])
{'id': id, 'title': 'Chat $id', 'directory': '/home/$id'},
],
});
}
if (type == 'directory_listing') {
final path = '${fields['path'] ?? '/home/a'}';
return Future.value({
'directory_listing': {
'path': path,
'home': '/home/a',
'entries': [
{'name': 'notes.md', 'path': '$path/notes.md'},
],
},
});
}
if (type == 'chat_shells') return Future.value({'chat_shells': []});
return super.call(type, fields);
}
@@ -248,6 +262,41 @@ void main() {
expect(tester.takeException(), isNull);
});
testWidgets('Ctrl+E opens and closes Files and restores composer focus', (
tester,
) async {
await _setup(tester);
final composer = _input('a');
await tester.tap(composer);
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pumpAndSettle();
expect(find.byType(FilesPanel), findsOneWidget);
final filter = find.descendant(
of: find.byType(FilesPanel),
matching: find.byType(EditableText),
);
expect(filter, findsOneWidget);
expect(
tester.widget<EditableText>(filter).focusNode.hasPrimaryFocus,
isTrue,
);
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pumpAndSettle();
expect(find.byType(FilesPanel), findsNothing);
await tester.pump(const Duration(milliseconds: 50));
expect(
tester.widget<EditableText>(composer).focusNode.hasPrimaryFocus,
isTrue,
);
expect(tester.takeException(), isNull);
});
testWidgets(
'drag compacts and expands sidebar without losing panes or drafts',
(tester) async {
@@ -10,6 +10,7 @@ import 'package:pipelines_app/features/chat/workspace/chat_center_stage_strip.da
import 'package:pipelines_app/features/chat/workspace/chat_motion_viewport.dart';
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
import 'package:pipelines_app/features/chat/workspace/chat_workspace_geometry.dart';
import 'package:pipelines_app/ui/input/keyboard_owner.dart';
class _MemoryStore implements ChatCenterStageStore {
_MemoryStore();
@@ -83,6 +84,8 @@ Widget host(
List<KeyEvent>? fieldKeys,
bool actionBars = false,
bool filesProbe = false,
VoidCallback? onToggleFiles,
bool terminalSurface = false,
ThemeMode themeMode = ThemeMode.light,
}) => MaterialApp(
themeMode: themeMode,
@@ -98,31 +101,45 @@ Widget host(
child: ChatCenterStageKeys(
controller: stage,
enabled: () => !singlePane,
child: ChatWorkspace(
controller: workspace,
centerStage: stage,
singlePane: singlePane,
paneTitle: (pane) => pane.sessionId,
paneBuilder: (_, pane, active) => Focus(
onKeyEvent: (_, event) {
fieldKeys?.add(event);
return KeyEventResult.ignored;
},
child: Column(
children: [
_Draft(key: ValueKey(pane.sessionId), name: pane.sessionId),
if (filesProbe) _FilesWidthProbe(name: pane.sessionId),
if (actionBars)
ChatWorkspacePaneActionBar(
child: TextButton(
key: ValueKey('action-${pane.sessionId}'),
onPressed: () {},
child: const Text('Action'),
onToggleFiles: onToggleFiles ?? () {},
child: Stack(
children: [
ChatWorkspace(
controller: workspace,
centerStage: stage,
singlePane: singlePane,
paneTitle: (pane) => pane.sessionId,
paneBuilder: (_, pane, active) => Focus(
onKeyEvent: (_, event) {
fieldKeys?.add(event);
return KeyEventResult.ignored;
},
child: Column(
children: [
_Draft(
key: ValueKey(pane.sessionId),
name: pane.sessionId,
),
),
],
if (filesProbe) _FilesWidthProbe(name: pane.sessionId),
if (actionBars)
ChatWorkspacePaneActionBar(
child: TextButton(
key: ValueKey('action-${pane.sessionId}'),
onPressed: () {},
child: const Text('Action'),
),
),
],
),
),
),
),
if (terminalSurface)
Positioned.fill(
child: TypingSurface(
child: Focus(autofocus: true, child: const SizedBox()),
),
),
],
),
),
),
@@ -510,19 +527,28 @@ void main() {
for (final mac in [false, true]) {
testWidgets(
'${mac ? 'Cmd' : 'Ctrl'}+E toggles; a plain e reaches the field',
'${mac ? 'Cmd' : 'Ctrl'}+Shift+E toggles; plain E reaches the field and the app chord toggles Files',
(tester) async {
wide(tester);
debugDefaultTargetPlatformOverride = mac
? TargetPlatform.macOS
: TargetPlatform.linux;
addTearDown(() => debugDefaultTargetPlatformOverride = null);
final workspace = threePanes();
final store = _MemoryStore();
final stage = ChatCenterStageController(store: store);
addTearDown(workspace.dispose);
addTearDown(stage.dispose);
final keys = <KeyEvent>[];
await tester.pumpWidget(host(workspace, stage, fieldKeys: keys));
var filesToggles = 0;
await tester.pumpWidget(
host(
workspace,
stage,
fieldKeys: keys,
onToggleFiles: () => filesToggles++,
),
);
await tester.tap(find.byKey(const ValueKey('input-three')));
await tester.pump();
@@ -538,7 +564,9 @@ void main() {
: LogicalKeyboardKey.metaLeft;
keys.clear();
await tester.sendKeyDownEvent(modifier);
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyUpEvent(modifier);
expect(stage.value, isTrue);
expect(store.saved, isTrue);
@@ -549,8 +577,21 @@ void main() {
await tester.pumpAndSettle();
expect(widthOf(tester, 'three'), 950);
// The other platform's chord stays with the field (Ctrl+E on a Mac is
// its end of line).
// The app platform's unshifted chord toggles Files.
keys.clear();
await tester.sendKeyDownEvent(modifier);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyUpEvent(modifier);
expect(stage.value, isTrue);
expect(filesToggles, 1);
expect(
keys.whereType<KeyDownEvent>().map((event) => event.logicalKey),
isNot(contains(LogicalKeyboardKey.keyE)),
);
// The other platform's unshifted chord stays with the field (Ctrl+E
// on a Mac is its terminal end of line).
keys.clear();
await tester.sendKeyDownEvent(other);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyUpEvent(other);
@@ -584,6 +625,26 @@ void main() {
},
);
test('Center Stage and Files use the physical E key', () {
const event = KeyDownEvent(
physicalKey: PhysicalKeyboardKey.keyE,
logicalKey: LogicalKeyboardKey.keyQ,
timeStamp: Duration.zero,
);
expect(
chatCenterStageShortcut(
event,
_CtrlShiftHeld(),
platform: TargetPlatform.linux,
),
isTrue,
);
expect(
chatFilesShortcut(event, _CtrlHeld(), platform: TargetPlatform.linux),
isTrue,
);
});
testWidgets('Alt+E toggles from a focused composer without typing', (
tester,
) async {
@@ -601,6 +662,39 @@ void main() {
expect(find.text('e'), findsNothing);
});
testWidgets('terminal keeps Ctrl+E but Center Stage chords still work', (
tester,
) async {
wide(tester);
final workspace = threePanes();
final stage = ChatCenterStageController(store: _MemoryStore());
var filesToggles = 0;
addTearDown(workspace.dispose);
addTearDown(stage.dispose);
await tester.pumpWidget(
host(
workspace,
stage,
terminalSurface: true,
onToggleFiles: () => filesToggles++,
),
);
await tester.pump();
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
expect(filesToggles, 0);
expect(stage.value, isFalse);
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
expect(stage.value, isTrue);
});
test('the choice is remembered', () async {
final store = _MemoryStore();
final first = ChatCenterStageController(store: store)..toggle();
@@ -629,3 +723,19 @@ class _AltHeld extends HardwareKeyboard {
@override
bool get isShiftPressed => false;
}
class _CtrlHeld extends HardwareKeyboard {
@override
bool get isAltPressed => false;
@override
bool get isControlPressed => true;
@override
bool get isMetaPressed => false;
@override
bool get isShiftPressed => false;
}
class _CtrlShiftHeld extends _CtrlHeld {
@override
bool get isShiftPressed => true;
}
@@ -13,6 +13,7 @@ const _implemented = [
'Focus the active chat composer',
'Send a chat message',
'Choose a slash command',
'Toggle Files',
'Toggle Center Stage',
'Stop a running chat',
'Focus the neighbouring chat pane',
@@ -91,6 +92,16 @@ void main() {
'Ctrl+Alt+Shift+Arrows',
);
expect(at(TargetPlatform.macOS, 'Stop a running chat').keys, 'Esc, Esc');
expect(at(TargetPlatform.macOS, 'Toggle Files').keys, 'Cmd+E');
expect(
at(TargetPlatform.macOS, 'Toggle Center Stage').keys,
'Option+E, Cmd+Shift+E',
);
expect(at(TargetPlatform.windows, 'Toggle Files').keys, 'Ctrl+E');
expect(
at(TargetPlatform.windows, 'Toggle Center Stage').keys,
'Alt+E, Ctrl+Shift+E',
);
expect(
at(TargetPlatform.macOS, 'Copy selected terminal text').keys,
'Cmd+C',