Merge branch 'worktree-agent-ad4dacaa0da379451'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,10 +7,10 @@ import '../conversation/chat_composer_paste_focus.dart';
|
||||
import '../ui/transcript/chat_link_launcher.dart';
|
||||
import 'chat_shell_metrics.dart';
|
||||
import 'chat_shell_terminal_bell.dart';
|
||||
import 'chat_shell_terminal_key_input.dart';
|
||||
import 'chat_shell_terminal_links.dart';
|
||||
import 'chat_shell_terminal_session.dart';
|
||||
import 'chat_shell_terminal_shortcuts.dart';
|
||||
import 'chat_shell_terminal_text_input.dart';
|
||||
import 'chat_shell_terminal_theme.dart';
|
||||
import 'chat_shell_terminal_find_host.dart';
|
||||
import 'chat_shell_terminal_view_features.dart';
|
||||
@@ -35,7 +35,8 @@ int chatShellCardRows(
|
||||
}
|
||||
|
||||
/// Whether the soft keyboard is the main way to type here, so the key
|
||||
/// toolbar offers a text field: the terminal itself takes hardware keys only.
|
||||
/// toolbar is the touch key row (sticky Ctrl and Alt, the keys a phone
|
||||
/// keyboard lacks, an optional line field).
|
||||
bool chatShellTouchFirst() =>
|
||||
defaultTargetPlatform == TargetPlatform.android ||
|
||||
defaultTargetPlatform == TargetPlatform.iOS;
|
||||
@@ -140,19 +141,28 @@ class _ChatShellTerminalViewState extends State<ChatShellTerminalView>
|
||||
if (_shortcuts.keys.any((key) => key.accepts(event, keyboard))) {
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
final session = widget.session;
|
||||
final bytes = chatShellKeyEventBytes(
|
||||
event,
|
||||
keyboard,
|
||||
session.terminal,
|
||||
optionAsMeta: session.optionAsMeta(),
|
||||
);
|
||||
final bytes = chatShellSessionKeyBytes(event, keyboard, widget.session);
|
||||
if (bytes == null) return KeyEventResult.ignored;
|
||||
session.terminal.textInput(bytes);
|
||||
if (scroll.hasClients) scroll.jumpTo(scroll.position.maxScrollExtent);
|
||||
_send(bytes);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
/// Committed text from the text input (see [chatShellTextInputBytes]).
|
||||
void _typed(String text) {
|
||||
final session = widget.session;
|
||||
final bytes = chatShellTextInputBytes(
|
||||
text,
|
||||
state: session.terminal,
|
||||
sticky: session.modifiers,
|
||||
);
|
||||
if (bytes != null) _send(bytes);
|
||||
}
|
||||
|
||||
void _send(String bytes) {
|
||||
widget.session.terminal.textInput(bytes);
|
||||
if (scroll.hasClients) scroll.jumpTo(scroll.position.maxScrollExtent);
|
||||
}
|
||||
|
||||
void _tapped(TapUpDetails details, CellOffset offset) {
|
||||
final link = chatShellTerminalLinkAt(widget.session.terminal, offset);
|
||||
if (link != null) openChatLink(context, link.uri);
|
||||
@@ -187,11 +197,16 @@ class _ChatShellTerminalViewState extends State<ChatShellTerminalView>
|
||||
textStyle: style,
|
||||
padding: padding,
|
||||
readOnly: !live,
|
||||
// Desktop keys go straight to the process as key events (a focused
|
||||
// text input stays closed in desktop browsers). On phones and
|
||||
// tablets a tap opens the on-screen keyboard and typing goes to the
|
||||
// terminal; the key toolbar's field stays as an alternative.
|
||||
hardwareKeyboardOnly: !chatShellTouchFirst(),
|
||||
// Typing goes through the text input everywhere, so IMEs, dead
|
||||
// keys, the emoji picker and dictation work: [_key] encodes the
|
||||
// special keys and chords first (a key it sends is never typed
|
||||
// again), and the text input types the characters, composing text
|
||||
// drawn at the cursor until committed. On phones and tablets a tap
|
||||
// opens the on-screen keyboard. A finished run attaches none.
|
||||
hardwareKeyboardOnly: !live,
|
||||
onTextInput: _typed,
|
||||
// A soft keyboard's Backspace on an empty field may send nothing.
|
||||
deleteDetection: chatShellTouchFirst(),
|
||||
// No autocorrect or suggestions rewriting what is sent to a shell.
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
shortcuts: _shortcuts,
|
||||
|
||||
Reference in New Issue
Block a user