The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Keep terminal Find stable during output and text composition
dee8b731065b92d
diff --git a/desktop/lib/widgets/terminal_find_bar.dart b/desktop/lib/widgets/terminal_find_bar.dartindex c4a94c799..e7a03d0a1 100644--- a/desktop/lib/widgets/terminal_find_bar.dart+++ b/desktop/lib/widgets/terminal_find_bar.dart@@ -51,6 +51,37 @@ class TerminalFindBarState extends State<TerminalFindBar> {}}+ KeyEventResult _onKeyEvent(FocusNode node, KeyEvent event) {+ if (event is! KeyDownEvent && event is! KeyRepeatEvent) {+ return KeyEventResult.ignored;+ }+ final keyboard = HardwareKeyboard.instance;+ if (keyboard.isMetaPressed ||+ keyboard.isControlPressed ||+ keyboard.isAltPressed) {+ return KeyEventResult.ignored;+ }+ final enter =+ event.logicalKey == LogicalKeyboardKey.enter ||+ event.logicalKey == LogicalKeyboardKey.numpadEnter;+ final escape =+ event.logicalKey == LogicalKeyboardKey.escape &&+ !keyboard.isShiftPressed;+ if (!enter && !escape) return KeyEventResult.ignored;+ final composing = _text.value.composing;+ if (composing.isValid && !composing.isCollapsed) {+ // Let the platform commit/cancel composition without a later shortcut+ // submitting the editor or closing Find instead.+ return KeyEventResult.skipRemainingHandlers;+ }+ if (escape) {+ widget.onClose();+ } else {+ widget.onStep(keyboard.isShiftPressed ? -1 : 1);+ }+ return KeyEventResult.handled;+ }+@overridevoid dispose() {_focus.removeListener(_onFocus);@@ -60,17 +91,9 @@ class TerminalFindBarState extends State<TerminalFindBar> {}@override- Widget build(BuildContext context) => CallbackShortcuts(- bindings: {- const SingleActivator(LogicalKeyboardKey.escape): widget.onClose,- const SingleActivator(LogicalKeyboardKey.enter): () => widget.onStep(1),- const SingleActivator(LogicalKeyboardKey.enter, shift: true): () =>- widget.onStep(-1),- const SingleActivator(LogicalKeyboardKey.numpadEnter): () =>- widget.onStep(1),- const SingleActivator(LogicalKeyboardKey.numpadEnter, shift: true): () =>- widget.onStep(-1),- },+ Widget build(BuildContext context) => Focus(+ canRequestFocus: false,+ onKeyEvent: _onKeyEvent,child: Material(color: const Color(0xff272727),shape: RoundedRectangleBorder(@@ -81,7 +104,36 @@ class TerminalFindBarState extends State<TerminalFindBar> {padding: const EdgeInsets.only(left: 10, right: 4, top: 2, bottom: 2),child: ListenableBuilder(listenable: widget.search,- builder: (context, _) {+ // Live output and result navigation update the controls, not the+ // editor. Keep its widget stable while the search index refreshes.+ child: Expanded(+ child: TextField(+ controller: _text,+ focusNode: _focus,+ autofocus: true,+ textAlignVertical: TextAlignVertical.center,+ style: const TextStyle(+ fontSize: 13,+ height: 1,+ color: Colors.white,+ ),+ decoration: const InputDecoration(+ hintText: 'Find in terminal…',+ hintStyle: TextStyle(color: Colors.white54),+ isDense: true,+ isCollapsed: true,+ constraints: BoxConstraints(),+ border: InputBorder.none,+ enabledBorder: InputBorder.none,+ focusedBorder: InputBorder.none,+ filled: false,+ contentPadding: EdgeInsets.zero,+ ),+ onChanged: (value) =>+ widget.onQuery(value, widget.search.caseSensitive),+ ),+ ),+ builder: (context, editor) {final search = widget.search;final status = search.query.isEmpty? ''@@ -124,33 +176,7 @@ class TerminalFindBarState extends State<TerminalFindBar> {),const SizedBox(width: 6),],- Expanded(- child: TextField(- controller: _text,- focusNode: _focus,- autofocus: true,- textAlignVertical: TextAlignVertical.center,- style: const TextStyle(- fontSize: 13,- height: 1,- color: Colors.white,- ),- decoration: const InputDecoration(- hintText: 'Find in terminal…',- hintStyle: TextStyle(color: Colors.white54),- isDense: true,- isCollapsed: true,- constraints: BoxConstraints(),- border: InputBorder.none,- enabledBorder: InputBorder.none,- focusedBorder: InputBorder.none,- filled: false,- contentPadding: EdgeInsets.zero,- ),- onChanged: (value) =>- widget.onQuery(value, search.caseSensitive),- ),- ),+ editor!,const SizedBox(width: 6),Semantics(liveRegion: true,diff --git a/desktop/test/terminal_find_test.dart b/desktop/test/terminal_find_test.dartindex 936079cf3..946186472 100644--- a/desktop/test/terminal_find_test.dart+++ b/desktop/test/terminal_find_test.dart@@ -57,6 +57,132 @@ Future<void> output();void main() {+ testWidgets(+ 'live output refreshes matches without rebuilding the Find editor',+ (tester) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ final input = <TerminalBinaryFrame>[];+ final session = terminal('a0', input);+ await output(+ session,+ 0,+ 'first marker\r\nsecond marker\r\n',+ keyframe: true,+ );+ app.adoptSessionForTest(session);+ final previousObserver = debugOnRebuildDirtyWidget;+ try {+ await mount(tester, app);+ await chord(tester, LogicalKeyboardKey.keyF);+ await tester.enterText(findField, 'marker');+ await finishFind(tester);+ final field = tester.widget<TextField>(findField);+ final search = tester+ .widget<TerminalFindBar>(find.byType(TerminalFindBar))+ .search;+ final selected = search.match;+ final view = terminalView(tester, session);+ final renderer = view.renderTerminal;+ field.controller!.value = field.controller!.value.copyWith(+ selection: const TextSelection.collapsed(offset: 3),+ composing: const TextRange(start: 0, end: 6),+ );+ await tester.pump();+ final editing = field.controller!.value;+ var editorBuilds = 0;+ debugOnRebuildDirtyWidget = (element, _) {+ if (element.widget is TextField &&+ (element.widget as TextField).controller == field.controller) {+ editorBuilds++;+ }+ };+ for (var sequence = 1; sequence <= 10; sequence++) {+ await output(session, sequence, 'next marker $sequence\r\n');+ await finishFind(tester);+ }+ debugOnRebuildDirtyWidget = previousObserver;+ debugPrint('FIND_OUTPUT: editorBuilds=$editorBuilds');+ expect(search.count, 12);+ expect(search.match, selected);+ expect(view.renderTerminal, same(renderer));+ expect(field.controller!.value, editing);+ expect(field.focusNode!.hasFocus, isTrue);+ expect(input, isEmpty);+ expect(editorBuilds, 0);+ } finally {+ debugOnRebuildDirtyWidget = previousObserver;+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ }+ },+ );++ for (final key in [+ LogicalKeyboardKey.enter,+ LogicalKeyboardKey.numpadEnter,+ LogicalKeyboardKey.escape,+ ]) {+ testWidgets('Find leaves ${key.keyLabel} to active text composition', (+ tester,+ ) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ final input = <TerminalBinaryFrame>[];+ final session = terminal('a0', input);+ await output(session, 0, '日本語 one\r\n日本語 two\r\n', keyframe: true);+ app.adoptSessionForTest(session);+ try {+ await mount(tester, app);+ await chord(tester, LogicalKeyboardKey.keyF);+ await tester.enterText(findField, '日本語');+ await finishFind(tester);+ final search = tester+ .widget<TerminalFindBar>(find.byType(TerminalFindBar))+ .search;+ final controller = tester.widget<TextField>(findField).controller!;+ final selected = search.selected;+ controller.value = controller.value.copyWith(+ composing: const TextRange(start: 0, end: 3),+ );+ await tester.pump();+ final handled = await tester.sendKeyEvent(key);+ await tester.pump();+ expect(findField, findsOneWidget);+ expect(search.selected, selected);+ expect(+ handled,+ isFalse,+ reason: 'the input method still owns this key',+ );+ expect(controller.text, '日本語');+ expect(tester.widget<TextField>(findField).focusNode!.hasFocus, isTrue);+ expect(input, isEmpty);++ controller.clearComposing();+ await tester.sendKeyEvent(key);+ await tester.pump();+ if (key == LogicalKeyboardKey.escape) {+ expect(findField, findsNothing);+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);+ await tester.pump(const Duration(milliseconds: 5));+ expect(input.single.bytes, [27, 91, 68]);+ } else {+ expect(search.selected, (selected + 1) % search.count);+ await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);+ await tester.sendKeyEvent(key);+ await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);+ await tester.pump();+ expect(search.selected, selected);+ expect(input, isEmpty);+ }+ } finally {+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ }+ });+ }+testWidgets('a narrow find bar supports large text and a large result count',(tester) async {diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.mdindex 7961f28a3..8f5deb1bf 100644--- a/docs/harness-v2-handoff.md+++ b/docs/harness-v2-handoff.md@@ -1,5 +1,22 @@# Harness v2: goal, plan, and continuation handoff+**Terminal Find editor correction:** Ten live output updates previously rebuilt+the Find text field ten times; the result controls now update around a retained+editor, reducing that count to zero while keeping the selected match, caret,+composition and focus. Enter/keypad Enter and Escape no longer navigate or close+Find during active text composition: they return to the platform input method.+After composition ends, Enter/Shift-Enter and Escape keep their normal actions,+including returning the next key to the terminal.++All **39 affected checks** pass in `/private/tmp/harness-find-editor-after.log`;+the failing-before cases are in `/private/tmp/harness-find-editor-before.log`.+Both changed files analyze cleanly in `/private/tmp/harness-find-editor-analyze.log`.+The full desktop suite passes **1,435 checks**, with one optional media placeholder+skipped, in `/private/tmp/harness-find-editor-full.log`. These are widget work+counts and composition-boundary checks, not native latency or live input-method+qualification. The prepared Release below predates this correction; its refresh+is pending. The running preview remains unchanged while the console is locked.+**Workspace event isolation:** `99d1ac9` is pushed. Routine heartbeats and dial scroll no longerrebuild the surrounding workspace or visit every retained terminal's JSONdispatcher. In the current 16-terminal/four-workspace fixture, 16 heartbeats wentdiff --git a/docs/harness-v2-performance.md b/docs/harness-v2-performance.mdindex a795901f6..dc6d08fad 100644--- a/docs/harness-v2-performance.md+++ b/docs/harness-v2-performance.md@@ -12,6 +12,27 @@ It prints `SWARM_BENCH` JSON records. Its filename deliberately does not end in## Current continuation benchmark (2026-09-14)+### Terminal Find editor work and composition keys++Ten matching output updates caused ten rebuilds of the Find text field even+though its editor value was unchanged. The result controls now refresh around+a retained editor widget. Replaying the same output causes **zero editor+rebuilds**, while the count advances from two to twelve matches and the selected+match, caret, composing range, focus and terminal renderer remain unchanged.+This is a deterministic widget work count, not a native latency measurement.++The same audit reproduced Enter/keypad Enter navigating matches during active+text composition, and Escape closing Find. These keys now return unhandled to+the platform input method without reaching later Flutter shortcuts. After+composition ends, Enter/Shift-Enter navigate normally; Escape closes Find and+the next terminal key still reaches the agent. The tests assert the unhandled+platform boundary, not a live native input-method session.++All **39 affected Find/search/reconnect/keyboard checks** pass in+`/private/tmp/harness-find-editor-after.log`; the failing-before cases are in+`/private/tmp/harness-find-editor-before.log`. Both changed files analyze cleanly+in `/private/tmp/harness-find-editor-analyze.log`.+### Routine events leave the surrounding workspace idleThe current New/Open UI was exercised with 16 retained terminals across four