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:
@@ -5,14 +5,22 @@ import 'package:flutter/widgets.dart';
|
||||
abstract final class ChatComposerPasteFocus {
|
||||
static final Set<FocusNode> _composers = {};
|
||||
|
||||
static final Set<FocusNode> _inputs = {};
|
||||
|
||||
static void register(FocusNode focus) => _composers.add(focus);
|
||||
static void unregister(FocusNode focus) => _composers.remove(focus);
|
||||
|
||||
/// An input that is not an [EditableText] (a shell command's terminal)
|
||||
/// registers its focus here: a paste while it has focus is its own.
|
||||
static void registerInput(FocusNode focus) => _inputs.add(focus);
|
||||
static void unregisterInput(FocusNode focus) => _inputs.remove(focus);
|
||||
|
||||
static bool get anotherEditableHasFocus {
|
||||
final primary = FocusManager.instance.primaryFocus;
|
||||
if (primary == null || _composers.any((focus) => focus.hasFocus)) {
|
||||
return false;
|
||||
}
|
||||
if (_inputs.any((focus) => focus.hasFocus)) return true;
|
||||
final context = primary.context;
|
||||
if (context == null) return false;
|
||||
var editable = context.widget is EditableText;
|
||||
|
||||
Reference in New Issue
Block a user