a6f0f0a1cb
A draft starting with ! shows a Shell mode indicator and runs through chat_shell_run instead of being sent to the agent; the chat's actions menu gains Run command. Each run is a terminal-style card among the turns with live output, Stop, its exit status, Copy output and Send to agent.
33 lines
1.3 KiB
Dart
33 lines
1.3 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
/// The one layout bound of a shell command card: how tall its output area
|
|
/// may grow. Collapsed it shows about [kChatShellOutputCollapsedLines] lines
|
|
/// of the host's (scaled) monospace text; expanded it may take
|
|
/// [kChatShellOutputExpandedShare] of the window height. Everything else in
|
|
/// the card is content-sized.
|
|
const int kChatShellOutputCollapsedLines = 12;
|
|
const double kChatShellOutputExpandedShare = 0.6;
|
|
|
|
/// The monospace line height factor the output text is set at.
|
|
const double kChatShellOutputLineHeight = 1.35;
|
|
|
|
/// Characters of output drawn at once. A command can print far more than a
|
|
/// text layout should carry; the card says when it shows only the newest
|
|
/// part, and Copy output still copies everything the server kept.
|
|
const int kChatShellRenderedOutputLimit = 64 * 1024;
|
|
|
|
/// The output area's maximum height for this window, text scale and font.
|
|
double chatShellOutputMaxHeight(
|
|
BuildContext context, {
|
|
required double fontSize,
|
|
required bool expanded,
|
|
}) {
|
|
if (expanded) {
|
|
return MediaQuery.sizeOf(context).height * kChatShellOutputExpandedShare;
|
|
}
|
|
final line =
|
|
MediaQuery.textScalerOf(context).scale(fontSize) *
|
|
kChatShellOutputLineHeight;
|
|
return line * kChatShellOutputCollapsedLines;
|
|
}
|