c5af000453
- Desktop and web terminals use the text-input path too, so IMEs, dead keys, the emoji picker and dictation work; the key handler still encodes special keys and chords first (handled keys are never typed again), composing text is drawn at the cursor and sent on commit, the platform editable sits at the cursor, and a closed input reopens on the next key. The editable terminal is a semantics text field so web typing also works with semantics on. - Web: "Capture browser keys" (terminal menu and right-click menu) goes full screen and calls navigator.keyboard.lock(); hold Esc to leave. No-op where unsupported; cheatsheet and menu note give alternatives. - Touch: scrollable key row with sticky Ctrl/Alt (tap once, double-tap lock), Esc, Tab, arrows, Home/End, PgUp/PgDn and symbols through the hardware encoder; soft keyboard types per key (delete detection, Return as Enter); the line field moves behind the row's Line button. - Capture kit: compose=, --semantics false, --user-agent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
2.4 KiB
Dart
80 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../ui/text/monospace.dart';
|
|
import 'chat_shell_runs_controller.dart';
|
|
import 'chat_shell_terminal_keys.dart';
|
|
import 'chat_shell_terminal_view.dart';
|
|
|
|
/// Opens [runId]'s terminal full screen: the same emulator the card draws,
|
|
/// sized to the window (a running process is resized to match), with the key
|
|
/// toolbar while it runs. Resolves when the page is closed.
|
|
Future<void> openChatShellTerminalPage(
|
|
BuildContext context, {
|
|
required ChatShellRunsController controller,
|
|
required String runId,
|
|
}) {
|
|
Widget page(BuildContext _) =>
|
|
ChatShellTerminalPage(controller: controller, runId: runId);
|
|
return Navigator.push<void>(context, MaterialPageRoute<void>(builder: page));
|
|
}
|
|
|
|
class ChatShellTerminalPage extends StatelessWidget {
|
|
const ChatShellTerminalPage({
|
|
super.key,
|
|
required this.controller,
|
|
required this.runId,
|
|
});
|
|
|
|
final ChatShellRunsController controller;
|
|
final String runId;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListenableBuilder(
|
|
listenable: controller,
|
|
builder: (context, _) {
|
|
final run = controller.run(runId);
|
|
final title = Text(
|
|
run == null ? 'Command' : '\$ ${run.command}',
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(fontFamily: appMonospaceFamily),
|
|
);
|
|
Widget body = const SizedBox.shrink();
|
|
if (run != null) {
|
|
final session = controller.terminals.session(run);
|
|
body = SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Expanded(
|
|
child: ChatShellTerminalView(
|
|
session: session,
|
|
fill: true,
|
|
autofocus: true,
|
|
),
|
|
),
|
|
if (session.live)
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 8),
|
|
child: ChatShellTerminalKeys(
|
|
session: session,
|
|
touch: chatShellTouchFirst(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
return Scaffold(
|
|
appBar: AppBar(title: title),
|
|
body: body,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|