Skip to content

Draw a draft's editor in the faces of the prose it replaces - #3776

Merged
max-sixty merged 2 commits into
mainfrom
edit-in-place
Oct 23, 2026
Merged

max-sixty merged 2 commits into
mainfrom
edit-in-place

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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

max-sixty and others added 2 commits October 23, 2026 04:51
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 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, and 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.

Behavior that changes 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; a press on it opens its source;
- the mark after a link that leaves the page shows, drawn by the same
  code as 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, not anywhere in the block.

browser/AGENTS.md's "Editing in place" now covers drafts, with
test_a_draft_edits_where_it_reads as its check.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	browser/runtime/prepaint.js
#	dist/kernel/kernel.json
@max-sixty
max-sixty merged commit 79af4eb into main Oct 23, 2026
3 checks passed
@max-sixty
max-sixty deleted the edit-in-place branch October 23, 2026 23:58
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