Files
ARCADIA-Studio/harness/text-selection-correction-20260913.md
T
sorokin.oleg.edu 2df7f580aa Make the Text workspace compact and preserve editing context
Replace the oversized header and reference rail with stable editor slots and a retained supporting drawer. Bind diagnostic, result and menu actions to their original publication and visit; preserve effective selections on navigation and dismiss Actions, Find and the drawer one surface per Escape.

Retain exact Windows source captures, eight final gates (871 desktop passes), independent reviews, native selection/rename/recovery trials and the original failures. All 526 tested inputs and staged evidence were byte-checked before commit. Combined preview integration and packaging remain with issue 27; Linux remains paused.
2026-09-12 22:00:36 -07:00

5.9 KiB
Raw Blame History

Text selection preservation

The initial native trial found that Find Close discarded a double-click selection while retaining the same raw cursor endpoints. The interaction contract distinguishes live focus restoration from a successful navigation departure. This report records the bounded correction and its evidence; it does not declare native or release acceptance.

Find: preserve the live editor

Find Close/Escape still creates an interaction-, source- and path-bound reveal ticket. Its intent has no cursor jump. Once the ticket is admitted, the existing guarded widget operation restores focus without calling Content::move_to. Real cursor navigation retains its existing validation and move. This keeps the actual Word/Line selection mode through Find rather than reconstructing it from lossy cursor endpoints.

The new evaluator uses actual mounted double/triple-click actions, a Find input and Close button, captured Escape plus the existing subscription message bridge, and the returned guarded widget operation. The CPU-mounted content and App's renderer-typed content are distinct: only the initial hit-tested caret is seeded into App before selection, then emitted selection/edit actions operate App's own content. Actual selection text and replacement bytes are checked. This is not a production GPU/window/scroll test; native replay remains required.

The exact regression archive contains 25 payloads (9,173,324 bytes), manifest SHA-256 4580d8cbc2f0347f1ebc1448728af6ef8885f6ebbd4c2d2dbe0c41eac97fb283. Its input maps prove the valid red and green runs differ only in production app/source_symbols.rs.

Run Result and interpretation
focus-red-1 All four tests failed in the new fixture before Find. Column::push had omitted a zero-height Find slot and a direct child-index lookup failed. This is not regression proof.
focus-red-2 Corrected fixture, exact old production: direct typing and intentional navigation passed; two checks failed with empty selected text instead of oa_contact. Completed 03:15:12 UTC, 164.01 s, all inputs unchanged.
focus-green-1 Rejected cache result: Cargo performed no compilation after restoring corrected bytes using a copy that preserved an older modification time. The run retained the predecessor's selection failures. It is not correction acceptance.
focus-green-2 Fresh actual compilation after updating only the corrected file's modification time: all four tests passed, 03:16:36–03:17:54 UTC, 77.97 s. Input bytes are identical to green 1 and unchanged throughout.

The valid red/green comparison changes source SHA-256 1fb3709bb973e7dcfbcde56054d028e47d770a62f3b7c8b6fac411543a234b7b to aa4f1423e759fdeaf7815d656b40189be176f4e8659f3da50debb5d85ed3af6c. Green stdout SHA-256 is 6f19f24e2fa37db4fc95c9b2d11b65e420299c6c6f90e4657e7e8e328b326fa0. This exact Find-only result predates the additional departure changes below.

Back and file departure: save the effective range

The existing navigation design requires exact selected bytes at an unchanged Back origin. Source review found the same lossy cursor representation in history and outgoing file buffers; this is a source-derived finding, not an additional old-native Back observation.

The new source_navigation::selection::capture uses the inspected Iced graphics editor's supported operation that collapses any selection to its effective start. Before that operation it copies the selected text. Cosmic's selection copy joins editor lines with LF, so its newline count and final segment byte length define the other endpoint without searching the source. The stored state is two positions, with temporary memory proportional to selected bytes. No source text, model, disk or Undo history is edited.

Capture occurs once after destination/admission checks in symbol jumps, Back, a different loaded file choice, source-location jumps and successful source creation. The same capture supplies history and the outgoing buffer. Changed-active-origin Back uses the captured current range, with the existing changed-position notice. Source creation completes its fallible preparation first and retains the undisplayed intermediate entry's own cursor rather than assigning it the outgoing editor's cursor. Failed/no-op navigation must not call capture.

Restoration preserves selected bytes and replacement behavior as a Normal range. It preserves direction when exposed by distinct raw endpoints, choosing the effective end for coincident Word/Line endpoints. It does not retain the hidden Word/Line drag-extension mode or interior click point after real navigation; Find preserves those by keeping the live editor. Full Content snapshots per history entry, source-string searching, guessed word boundaries, unsafe editor access and dependency vendoring were rejected as unnecessary or less reliable for the required byte-range behavior.

Seven helper tests cover Unicode, repeated words, directional ranges, expanded word/line selections, physical CRLF/mixed endings, trailing newline and empty selections. Four App tests cover file/definition/Back round trips and replacement, changed-active fallback, failed/no-op/stale requests, and creation with an undisplayed entry. Independent static review checked the helper's primary-source semantics and all five guarded capture sites. It identified a test setup that moved a cursor without clearing its previous selection; the fixture now explicitly clears it and verifies the intended single-character edit. The subsequent attempt-5 and native trial-2 report records the combined executed gates (871 full passes) and native replacement checks for Find, Back and file return. That report retains its own source binding and additional Escape finding; the earlier four-pass Find result alone does not substitute for combined evidence.