Fit chat terminals to their output, keep pastes and keys in the terminal
Finished terminals are sized synchronously from their rows at the view's width (the post-frame fit made the transcript re-anchor forever); blank rows xterm.dart keeps when rewrapping are dropped; desktop typing uses key events; the composer leaves Cmd/Ctrl-V to a focused terminal; Ctrl-A reaches the process. The probe fixture gains coloured terminal runs and an interactive login. Notes record behaviour, protocol, security and verification.
This commit is contained in:
@@ -39,12 +39,36 @@ void main() {
|
||||
expect(find.byKey(const Key('chat-shell-terminal-field')), findsNothing);
|
||||
await tester.tap(find.byType(TerminalView));
|
||||
await tester.pump();
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.keyG);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.digit7);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowUp);
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.keyC);
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
|
||||
await tester.pump();
|
||||
expect(typed(), '\x1b[A\x03');
|
||||
expect(typed(), 'g7\x1b[A\x03');
|
||||
// Cmd-V pastes the clipboard into the process.
|
||||
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
|
||||
SystemChannels.platform,
|
||||
(call) async =>
|
||||
call.method == 'Clipboard.getData' ? {'text': 'tok'} : null,
|
||||
);
|
||||
addTearDown(
|
||||
() => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
|
||||
SystemChannels.platform,
|
||||
null,
|
||||
),
|
||||
);
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.metaLeft);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.keyV);
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.metaLeft);
|
||||
for (var i = 0; i < 5; i++) {
|
||||
await tester.pump(const Duration(milliseconds: 20));
|
||||
}
|
||||
expect(typed(), 'g7\x1b[A\x03tok');
|
||||
// The chat composer leaves a paste into the terminal alone.
|
||||
expect(find.text('tok'), findsNothing);
|
||||
expect(find.byType(EditableText), findsWidgets);
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
expect(gateway.bodies('chat_shell_input').first['run_id'], 'run_t');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user