Draw chat shell runs in an xterm terminal that takes typed input
The card's output area is now an xterm.dart emulator kept per run by the controller: it is fed the raw stream in order, takes typing and paste while the command runs (with a key toolbar and a soft-keyboard field on touch platforms), resizes the process to its layout, opens printed links, shrinks finished runs to their output and opens full screen. A reconnect resumes from the byte the card holds; Copy output copies the server's plain text.
This commit is contained in:
@@ -10,10 +10,12 @@ import 'chat_shell_output_view.dart';
|
||||
import 'chat_shell_run.dart';
|
||||
import 'chat_shell_runs_controller.dart';
|
||||
import 'chat_shell_status.dart';
|
||||
import 'chat_shell_terminal_page.dart';
|
||||
|
||||
/// One operator command in the transcript, as a terminal-style card in the
|
||||
/// reading column: the command and folder, its live output, a spinner and
|
||||
/// Stop while it runs, then its exit status, Copy output and Send to agent.
|
||||
/// One operator command in the transcript, as a terminal card in the reading
|
||||
/// column: the command and folder, its terminal (typed into while it runs),
|
||||
/// a spinner and Stop while it runs, then its exit status, Copy output and
|
||||
/// Send to agent. Full screen opens the same terminal over the whole window.
|
||||
///
|
||||
/// It listens to [controller] itself, so streamed output rebuilds only this
|
||||
/// card, never the transcript.
|
||||
@@ -32,7 +34,23 @@ class ChatShellRunCard extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
||||
bool _expanded = false;
|
||||
bool _fullScreen = false;
|
||||
int _viewGeneration = 0;
|
||||
|
||||
Future<void> _openFullScreen(bool cupertino) async {
|
||||
setState(() => _fullScreen = true);
|
||||
await openChatShellTerminalPage(
|
||||
context,
|
||||
controller: widget.controller,
|
||||
runId: widget.runId,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_fullScreen = false;
|
||||
_viewGeneration++;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -113,8 +131,10 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
||||
const SizedBox(height: 12),
|
||||
ChatShellOutputView(
|
||||
run: run,
|
||||
controller: controller,
|
||||
cupertino: cupertino,
|
||||
expanded: _expanded,
|
||||
viewKey: ValueKey<int>(_viewGeneration),
|
||||
fullScreen: _fullScreen,
|
||||
),
|
||||
if (run.error.isNotEmpty && !run.running)
|
||||
Padding(
|
||||
@@ -129,8 +149,7 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
||||
run: run,
|
||||
controller: controller,
|
||||
cupertino: cupertino,
|
||||
expanded: _expanded,
|
||||
onToggleExpanded: () => setState(() => _expanded = !_expanded),
|
||||
onFullScreen: () => _openFullScreen(cupertino),
|
||||
),
|
||||
if (error != null)
|
||||
Semantics(
|
||||
|
||||
Reference in New Issue
Block a user