Terminal round 2: tests for every feature; split find host and tab events
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import 'chat_shell_terminal_links.dart';
|
||||
import 'chat_shell_terminal_session.dart';
|
||||
import 'chat_shell_terminal_shortcuts.dart';
|
||||
import 'chat_shell_terminal_theme.dart';
|
||||
import 'chat_shell_terminal_find_host.dart';
|
||||
import 'chat_shell_terminal_view_features.dart';
|
||||
import '../../../ui/input/keyboard_owner.dart';
|
||||
|
||||
@@ -57,6 +58,7 @@ class ChatShellTerminalView extends StatefulWidget {
|
||||
class _ChatShellTerminalViewState extends State<ChatShellTerminalView>
|
||||
with
|
||||
SingleTickerProviderStateMixin,
|
||||
ChatShellTerminalFindHost<ChatShellTerminalView>,
|
||||
ChatShellTerminalFeatures<ChatShellTerminalView> {
|
||||
@override
|
||||
final TerminalController controller = TerminalController();
|
||||
@@ -132,24 +134,6 @@ class _ChatShellTerminalViewState extends State<ChatShellTerminalView>
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
/// A finished run's output takes no keys of its own, so the copy keys
|
||||
/// (and the view's own) are answered here while it has the keyboard.
|
||||
KeyEventResult _readOnlyKey(FocusNode node, KeyEvent event) {
|
||||
if (localKey(event)) return KeyEventResult.handled;
|
||||
if (event is! KeyDownEvent ||
|
||||
event.logicalKey != LogicalKeyboardKey.keyC &&
|
||||
event.logicalKey != LogicalKeyboardKey.insert) {
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
final keyboard = HardwareKeyboard.instance;
|
||||
if (!keyboard.isControlPressed && !keyboard.isMetaPressed) {
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
return actions.copySelection()
|
||||
? KeyEventResult.handled
|
||||
: KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
void _tapped(TapUpDetails details, CellOffset offset) {
|
||||
final link = chatShellTerminalLinkAt(widget.session.terminal, offset);
|
||||
if (link != null) openChatLink(context, link.uri);
|
||||
@@ -215,7 +199,7 @@ class _ChatShellTerminalViewState extends State<ChatShellTerminalView>
|
||||
onPointerDown: (_) => _outputFocus.requestFocus(),
|
||||
child: Focus(
|
||||
focusNode: _outputFocus,
|
||||
onKeyEvent: _readOnlyKey,
|
||||
onKeyEvent: readOnlyKey,
|
||||
child: view,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user