Skip to content

Retain the comment text viewport separately from attachments - #2136

Merged
max-sixty merged 4 commits into
mainfrom
codex/retain-comment-text-viewport
Oct 9, 2026
Merged

max-sixty merged 4 commits into
mainfrom
codex/retain-comment-text-viewport

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Sending a short drawing comment retained the editor's 32px viewport on the entire message body. Adding the drawing reference then created an unnecessary scrollbar, and removing the attachment shelf moved the submitted words. Long comments also lost room for their drawing reference when the card was resized.

Retain the viewport and scroll position on the submitted text alone. Project pasted attachments through the existing media reading into a sibling message region, and derive the reserved card frame from the text field and shared padding. Text can shrink with the transcript while drawing metadata keeps its room and images remain available in the normal transcript flow.

The long-comment journey also exposed a CodeMirror wrapping bug: its width-change comparison used a value it had just overwritten, leaving height estimates based on the old width and exhausting the measurement loop. The existing vendoring adapter now compares the current column count with the oracle's last measured estimate, including accumulated small width changes and its five-column minimum.

Validation includes the original failure with CI's DejaVu fonts, gradual width growth and shrink, tiny and unchanged widths, short and scrolled drawings on desktop and touch, pasted-photo viewing, keyboard reading, all eight Mac appearance journeys and the snapshot helpers, 276 runtime tests, and independent code/browser review. Bundle rebuilding is byte-identical. Reading-key checks follow the text viewport. The integration preserves main's window-bounded composer growth and passes all five drawing cases after that change.

This was written by Codex on behalf of max-sixty

Only submitted words inherit the editor viewport and scroll position. Keep drawing references and pasted images in their own message regions, and derive the reserved card frame from the text field so disappearing attachment shelves cannot carry sent words.

Let the retained text track shrink with its card after resize. Cover short and scrolled drawings on desktop and touch, pasted-photo visibility and image viewing, and the existing Send journeys. Update the compact handoff focus assertion to the page-thread focus contract.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new phone/scrolled drawing case fails at browser teardown after the resize in test_render_drawing.py: clean_browser reports Measure loop restarted more than 5 times. Its assertions pass, but I reproduced the teardown error twice on this head and once with this test copied onto the base tree. This exposes an existing measure-loop problem rather than a rendering regression from this diff; as added, the case cannot pass the browser test gate. The resize journey needs to complete without that warning before this test can protect the change.

Compare current wrapped columns against the height oracle, including accumulated sub-character resizes and the existing minimum. CodeMirror previously overwrote its width before testing for a change; a 60-line phone comment with DejaVu fonts then exhausted the measure loop. Adapt the pinned module at the bundling owner and keep one shared module identity.

Read the retained text viewport in the keyboard journey, including pending delivery, scrolling and a second comment. Verified the original font reproduction, gradual growth/shrink, tiny and unchanged widths, bundle reproducibility, appearance snapshots and independent browser/code reviews.
leaf-agent
leaf-agent previously approved these changes Oct 9, 2026
Keep the native input explicit in the placement interface so Send captures its text viewport while main retains window-bounded composer growth. Wait for the card reveal before testing the pasted photo hit target, then click its center without automatic scrolling.
@max-sixty
max-sixty merged commit d12f1cc into main Oct 9, 2026
6 checks passed
@max-sixty
max-sixty deleted the codex/retain-comment-text-viewport branch October 9, 2026 08:29
leaf-agent added a commit that referenced this pull request Oct 15, 2026
The sent-drawing browser case now reads its retained scroll from the
thread transcript. #2985 intentionally moved a long sent comment's
scrollport from the first message to that transcript, but this case
still required an inner `.lf-msg-text` scrollbar and failed on the new
layout.

The test continues to check the drawing-reference behavior introduced by
#2136: the reference follows the comment text, the message body does not
clip it, and it remains inside the visible transcript after a long card
is resized. Its short phone and long desktop variants both pass with the
transcript as the scrollport.

Verification: both focused browser variants pass; Ruff format and `git
diff --check` pass. The long variant failed at the old inner-scroll
assertion before this change.

Co-authored-by: leaf-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants