Fix web transcript cross-message selection
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# Web transcript selection acceptance
|
||||
|
||||
The web transcript now has one SelectionArea around the real transcript scroll
|
||||
view, with the composer outside it. Operator text without links participates
|
||||
as Text rather than a nested SelectableText. Markdown and linked operator text
|
||||
reuse the document registrar, while link-aware Copy link is supplied to the
|
||||
shared menu. Native/standalone renderers retain their previous selection areas.
|
||||
A new pointer selection clears remembered link context before a link recognizer
|
||||
can supply the touched URL, so plain text never offers an old link's menu item.
|
||||
|
||||
The first Mobile candidate only tested structure and left the plain-user branch
|
||||
isolated. Actual forward/backward clipboard tests failed: forward copied only
|
||||
`User question`; backward copied only `Assistant answer.`. Baseline evidence:
|
||||
`/tmp/memwatch/out.JDbEfN` (0 passed, 2 failed). Those same assertions pass after
|
||||
the participation fix. Tests now assert clipboard contents, not widget counts
|
||||
or an untouched mock value.
|
||||
|
||||
Acceptance also found an unrelated-code leak while selecting a later paragraph:
|
||||
`Read here now` copied `earlierCode();latestCode();Read here now`, even without
|
||||
slivers (`/tmp/memwatch/out.qSXIK1`). A point below-left of a horizontal code
|
||||
viewport has both positive-outside Y and negative X. Flutter's nested scrollable
|
||||
checks negative coordinates first, treating that selection start as before its
|
||||
content, then treats the drag end as after it. The viewport's full code leaks
|
||||
into a range that never crosses it.
|
||||
|
||||
The shared-web markdown horizontal viewport now gives vertical before/after
|
||||
meaning priority when the point is outside its height, normalizing only X for
|
||||
that edge event before forwarding to Flutter. Inside-viewport horizontal
|
||||
selection/scrolling remains Flutter's own behavior. This wrapper is used for
|
||||
code and tables only under the shared transcript scope. It does not invent or
|
||||
rewrite copied text. Exact later-paragraph copying and intentionally crossed
|
||||
multiline code both pass, in both directions.
|
||||
|
||||
Verification:
|
||||
- 145 focused transcript, actual ChatThreadView, existing link/native controls,
|
||||
and stream-rebuild performance tests pass via memory watchdog; peak 1341 MB,
|
||||
21 seconds (`/tmp/memwatch/out.PCzk3H`).
|
||||
- Real ChatThreadView tests retain a non-null splitAfter by using long earlier
|
||||
history. The newest plain user precedes the centre split, its answer follows;
|
||||
forward/backward copied text is in visual order and excludes earlier history
|
||||
and the real composer's unchanged draft.
|
||||
- Tests include precise multiline code, composer-native editing after selection,
|
||||
retained copied selection after an unrelated update, desktop activation and
|
||||
context Copy link, touch Copy link and plain-context reset, native fallback.
|
||||
- Focused analyze clean (`flutter-analyze.8WpzRq`). Fixture web build and Wasm
|
||||
dry run passed. No full app suite or deployment was run in this repair lane.
|
||||
|
||||
Final real Chrome captures, all eleven PNGs inspected:
|
||||
- `/tmp/transcript-selection-final-wide/`: 1100x1000, links=0, forward/backward
|
||||
plain-user cross-message selection, through-code range, composer exclusion.
|
||||
- `/tmp/transcript-selection-final-narrow/`: same assertions at 560x1000.
|
||||
- `/tmp/transcript-selection-final-link-range/`: links=1, paragraph-only range;
|
||||
its observed copy is `Read the release notes or https:/`, with no other code
|
||||
or message included. The earlier browser failure copied three code blocks.
|
||||
- `/tmp/transcript-selection-final-links/`: links=1, a drifting link click opens
|
||||
the intended URL once, and dragging from plain text across it opens nothing.
|
||||
|
||||
The wide/narrow/range scripts observe navigator.clipboard.writeText arguments
|
||||
from actual Command+C interactions and assert their bytes; selection behavior
|
||||
itself is not mocked. This does not claim OS clipboard persistence, real Safari
|
||||
behavior, or physical-device touch verification. Capture-owned Chrome instances
|
||||
and isolated loopback servers exited normally.
|
||||
|
||||
Known follow-up, deliberately separate: Flutter concatenates semantic block and
|
||||
message text when copying (for example `Question 2Answer 3Some...`). Code's
|
||||
internal newlines remain exact. Paragraph/message copy separators were not
|
||||
bundled into this selection-range change.
|
||||
Reference in New Issue
Block a user