Repository navigation
Keep a message rewrite where the message stood - #3737
Merged
Merged
Conversation
Opening a rewrite of the user's own message moved its pictures from under the words into a draft's 120px cropped shelf above the field, pushing the words down by the pictures' height. In the floating panel the words also rewrapped, since the field ignored the column the message keeps at their end; in Feed mode they moved right by the field's inset, and everywhere but the margin card down by its padding. The head dropped its time and receipt. A rewrite now keeps every line of the words, the pictures and the head as the message showed them, on every surface (panel, seat, margin card, a package reader's Feed and Conversation modes), in Chromium and Firefox: - The pictures stand in the field under the words, drawn as the message draws them (`sentMedia` in input.js, which replaces the unused `mediaBelow`), each with a removal mark. - The field's frame and padding stand in the room around the content, reaching past it by negative margins, so the message keeps its height. - The user's own words and pictures keep the column of the box they write in (`--lf-msg-text-end`): the panel already did this; seats and package readers now end them the reply field's press room short of the edge. The margin card's column moves onto the same property. - A message's pictures no longer leave their last paragraph's margin below them, as its words already didn't. - The feature gallery's reader keeps 12px inside its scroll for the frame. browser/AGENTS.md gains "Editing in place", the principle that editing keeps a thing where it stood and as it read. test_a_rewrite_keeps_the_message_as_it_stood covers five surfaces; test_a_rewrite_is_the_reply_box_where_the_words_stood now holds the first line and the thread still on every surface, and no longer requires the seat's rewrite to be the reply box's height or Feed's words to take the reply box's inset. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review of the previous commit found three faults: - A rewrite compared and reloaded its field's `.value`, the words alone. Taking a picture off a message of pictures closed the box as no change and the picture came back. It now reads the whole draft through the composer's `sync.value()` and reloads through `sync.load()`. - The removal mark lost `--lf-media-mark-overhang`, defined only on a draft's shelf, and sat at the picture's top left. A rewrite's pictures now define it too. - Ending the user's words 40px short in seats and readers rewrapped a reply once sent, since the reply box ends its lines only the text inset short (the press takes room on its last line alone). The column now ends at that inset, so a reply breaks where it was typed, and a seat's rewrite is exactly its reply box's width. A message of pictures alone still gains one line on opening, for the caret. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A rewrite's pictures stand under its words, so one pasted there could arrive below the panel's view with nothing on screen changing. It now comes into view once decoded, unless the user has moved on meanwhile. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # browser/runtime/thread/message-edit.js # dist/kernel/kernel.json
# Conflicts: # dist/kernel/kernel.json
leaf-agent
previously approved these changes
Oct 23, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 23, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The new editing rule describes all editors, although lf-draft still opens rendered Markdown as source text. The PR description already identifies that surface as follow-up work. Scope this contract to message rewrites for now so agents reading browser/AGENTS.md do not assume the wider guarantee already holds.
A draft's editor still opens its prose as Markdown source in a sent message's face, so the principle now names that case rather than claiming every editor holds it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 23, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 23, 2026
Main's rewrite-in-place (#3737) and the thread walk's aside (#3733) read the old sizes; they read the line now. The aside shares the drafting rule's Send room, so the two can't drift. Discard and Save, positioned relatively to hold their reach, clear the message control's anchored offsets, which had lifted them 6px and cut Save's focus ring. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 23, 2026
Opening a draft drew its Markdown in a sent message's face, so every word after its first block moved: a heading shrank from 24px to 17px, each gap between paragraphs grew by 14px, a code block's code dropped 21px, a 388px picture became a 158px line of source, and the mark after an external link vanished. Each word, picture and mark now stays where the prose showed it, in Chromium and Firefox. The user chose this over drawing drafts in a message's face; it completes the "Editing in place" rule #3737 added to `browser/AGENTS.md`. - **Faces** (`composing/text-field.js`): the draft names its prose as the element the field's words are shown as (`facesOf`). As the editor builds, and when its width changes, an empty copy of that element holding one of each block stands hidden beside the field and is read, so the page's own rules and density reach it. The rules it yields go in a sheet of the field's own; each line names its block's face and the gap before it, so blank source lines stand as the gap the prose leaves between two blocks, inside quotes too. - **In every editor**, the reply box and message rewrites included: a picture is drawn as the picture and stays drawn after its source while the caret is in it, and a press on it opens its source; the mark after a link that leaves the page shows, drawn by the code that draws the page's (`prepaint.js` now shares it); a code fence's line and a Setext heading's rule show their marks only while the caret is on that line. - Still source-shaped: the gaps inside a loose list, a table, and a page rule giving a draft's first block its own top margin. Moving the caret onto a fence's line adds 7px. `test_a_draft_edits_where_it_reads` checks each word, the picture and the mark across a draft with headings, a link, blank-line runs, a list, a fence, a quoted heading, a Setext heading and a picture, then typing a new paragraph, the caret in code, a press on the picture, and pictures named by reference or split across lines. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 25, 2026
A message the user sent ended its lines up to 86px short of the agent's reply under it: 86px in the floating panel and 41px in a thread on the page, the room Send takes in the field it was typed in. #3679, a CI fix, narrowed the panel's user messages to the field's width so a draft's list would wrap as the sent message does; #3737 and #3813 widened that room to Send's on every surface. No review weighed the cost to every message the user reads back. A user's message now ends the thread's text inset short of the column (8px in the panel, 13px on the page), as far in as it starts, which is the room its rewrite's frame stands in, so a rewrite still keeps every line where it stood and its frame inside the reply box's width. That makes the rewrite's reach past the column (`--lf-msg-edit-past-end`) always zero, so it goes, with the panel's own sum and the root copy of `--lf-compose-send-end`. A margin card keeps its messages on the comment box's column, as before. Behavior change: a reply typed in the panel or a page thread can rewrap when sent, as one typed in a margin card already did. `test_the_user_s_words_end_where_the_agent_s_do` fails on main by 86px (panel) and 41px (page) and passes here. `test_a_draft_draws_a_list_as_the_message_will` now gives its long list item two lines' worth of words, which wrap to two lines in the field and in the wider sent column alike; its three-line item wrapped a line shorter once sent. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewriting your own message used to swap the message for a reply box. On every surface that draws messages, the words dropped 130–139px, the attached picture jumped above the words as a 240×120 crop, and the next turn moved up by as much as 148px. Now the rewrite is a field framed around the message as it was drawn. Opening one adds only the field's frame, Discard and Save, and a removal mark on each picture. In Chromium and Firefox, the first word, the picture and the next turn move 0px on the floating panel, a thread in the page, a margin card, and a package reader's Feed and Conversation.
composing/input.js): the editor draws a sent message's pictures inside the field, under the words, with the markup a sent message uses (sentMedia, replacing the unusedmediaBelow). A picture pasted into a rewrite scrolls into view once it has decoded.response.css): the field takes the message's font and reaches past the message's box by negative margins, so its padding draws the frame around words that stay put.reading.css): in a page thread and a package reader, your own messages now end 13px short of the edge, the same inset the reply box has. A reply then breaks its lines where it broke while you typed it, and its rewrite is exactly the reply box's width. The floating panel and the margin card already matched their boxes.thread/message-edit.js): the rewrite compares the whole draft, words and pictures, with the message. It used to compare words alone, so taking a picture off a message of pictures closed as "no change" and the picture came back.browser/AGENTS.md, "Editing in place"): editing something keeps it where it stood and as it read.module-annotations.mdasks package readers to keep about 12px of padding in a scroller that holds message parts, as the feature gallery's reader now does.A survey of other edit surfaces found one more that breaks the principle: a draft's editor draws Markdown in the message face where its display uses page prose, and neither the draft editor nor the rewrite draws the ↗ mark after an external link. Fixing that is the next change.
test_rewrites.pygainstest_a_rewrite_keeps_the_message_as_it_stoodacross the five surfaces, andtest_a_rewrite_saves_the_pictures_it_keeps.