Skip to content

Keep Send's room after a comment's last words only - #1871

Merged
max-sixty merged 26 commits into
mainfrom
thread-card-message-wrap
Oct 6, 2026
Merged

max-sixty merged 26 commits into
mainfrom
thread-card-message-wrap

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A comment field kept its Send arrow's column clear on every line, and a sent comment kept the same wrapping, so every message ended about 40px short of its card. The field now keeps that room after its last words only, where Send stands beside the last line, so the lines above wrap at the field's full width. With #1863, a just-sent comment's words now end 13–18px from the Reply field's edge, against 94px before.

  • Field (composing/text-field.js): the room is an inline-block after the last document line, drawn while that line has words, and sized by --lf-field-end-room, a registered length. Two cases hold the room on every line instead, since other lines then pass beside Send: under a coarse pointer, whose 44px hit box is taller than a line, and while the field scrolls. A resize observer reads whether the field scrolls into :state(scrolls). The CSS scroll-state query it replaces exists only in Chromium, so Firefox and Safari kept main's wrapping. endRoom reports which mode holds.
  • Composers: the margin composer, card and panel replies, the page comment, the inline field and an Ask's Add row state the room as --lf-field-end-room instead of a right padding.
  • Sent card: it carries the field's mode across the send (data-lf-comment-frame) and draws the same room, so no word moves when the draft becomes a message. That holds for paragraphs. A list, quote or heading renders with a different indent or font from its source, so it rewraps at Send, as on main. Across 26 lengths each, a quote rewrapped every time on both; a heading 24 times on main and 19 here; a list 12 times on main, where its indent happened to roughly match the room on every line, and every time here.
  • Tests: the chrome contracts read the new contract. One new test opens a line under a full last line with Shift+Enter, then types on it, and asserts that nothing above moves. Another holds the room on every line only while the field scrolls, in Chromium and WebKit; it fails on the scroll-state rule. leaf-dev stills gains 15 states with long drafts and a sent comment. The Mac thread snapshots are re-accepted: 25 composer stages change.

Phones keep the room on every line. Send's 28px box reaches 2–3px into the line above the last at the field's end; that was reviewed and accepted. A last row that fills the field puts the room on a row of its own.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 26 commits October 4, 2026 11:08
A just-sent margin comment keeps its editor's wrapping (#1587), and the
editor reserved the Send action's column on every line, though Send
stands only at the field's bottom-end corner. The sent message showed
that reservation as an empty band down the card's right side.

`leaf-text` now keeps `--lf-field-end-room` after its last line with
words only, so the lines above wrap at the field's full measure. Under a
coarse pointer, whose hit box is taller than a line, and while the field
scrolls (a scroll-state container query), other lines pass beside Send,
so there the room stays on every line. The field reports which it holds
(`endRoomOnEveryLine`); the margin card records it at send as
`data-lf-comment-frame="every-line"|"last-line"` and the sent message
holds the room the same way, so words still do not move on send. Every
composer with a corner action uses the same room, lf-options' Add row
included.

Tests: send placement asserts the editor's mode before send and the
card's attribute after; the thread contract reads the room in its text
column and asserts the scrolled draft holds it on every line; the Add
row test reads the room instead of the padding. The thread snapshot
images change where a draft's first line now runs to the field's end.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	README.md
#	leaf-assets.json
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Assembled from CI run 37224082891's evidence: each case's actual PNGs
and observed regions, whose geometry matches the pinned set. The images
change only where a draft's first line now runs to the field's end.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Firefox and Safari have no scroll-state container queries, so a field
there cannot tell when it scrolls; it keeps the room on every line, as
before, rather than let a scrolled line run under Send.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dev/leaf_dev/stills.py
The room stood on the last line with words, so opening a line with
Shift+Enter left it on the line above, and the first character typed
on the new line took it away: the line above rewrapped, and where its
room had stood on a line of its own the field shrank under the caret.
Deleting a last line back to blank moved it the other way. The room
now stays on the last line and is drawn only while that line has
words, so it changes lines with the keystroke that changes the lines.

The field reports where it holds the room (`endRoom`: every-line,
last-line, or none while its last line is blank), and the sent card
holds the same, so a draft sent on a blank last line keeps its
wrapping too.

A test types a last line that fills the field, opens a line under it,
and types on it, and fails on the earlier rule (the field grew from 79
to 100px under the caret).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	README.md
#	leaf-assets.json
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Assembled from CI run 37248173787's evidence, whose geometry matches
the pinned set. The images change where a draft's first line now runs
to the field's end; the pending stages differ by a few pixels of
antialiasing at the field's edge.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Accepting a profile stages it on the asset repository's latest commit,
not on the pinned one, so the Linux acceptance carried another branch's
Mac images. This pin holds both of this branch's captures.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	README.md
#	leaf-assets.json
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	README.md
#	leaf-assets.json
Staged on main's pin d8f2114 rather than leaf-assets HEAD, which carried
other branches' example previews.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	README.md
#	leaf-assets.json
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e query

The field keeps Send's room after its last words until its words scroll. It
told scrolling with a CSS scroll-state container query, which only Chromium
supports, and held the room on every line wherever the query was missing,
so in Firefox and Safari the field and the sent card wrapped as before:
the band the change removes stayed. A resize observer on the host and the
editor's scroller now sets the host's :state(scrolls), which the sheet keys
on in every engine. A WebKit case joins the Chromium one.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	leaf-assets.json
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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 sent frame loses its last-line room when the comment ends in Markdown other than a direct paragraph. In annotation-chrome.css, the new ::after matches only a direct <p> (or suggestion text). For - a long list item, > a quote, or # a heading, the draft reports last-line, but the renderer ends with <ul>, <blockquote>, or <h1>, so the sent card has no corresponding room. Its last words gain Send's width and can rewrap at the moment of submission, breaking the frame continuity this PR establishes. The room needs to follow the final rendered text block for these supported Markdown forms too.

@max-sixty
max-sixty merged commit 35647d9 into main Oct 6, 2026
4 checks passed
@max-sixty
max-sixty deleted the thread-card-message-wrap branch October 6, 2026 06:03
leaf-agent added a commit that referenced this pull request Oct 6, 2026
The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/37423492016) failed
the README media check because #1871 changed three README URLs to asset
revision `04db6cf8` while `leaf-assets.json` still pins media revision
`1638ca30`. The intervening asset commits changed only thread snapshots,
so this restores the README URLs to the existing media pin and keeps the
demo images unchanged.

`uv run pytest -q -n0
tests/test_site.py::test_the_readme_draws_its_images_from_the_pinned_assets`
failed before the change and passes after it. This PR fixes that failure
only; the compact comment and focus ring failures in the same run have
separate diagnostics. The code Copy failure was already fixed by #1886.

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 7, 2026
)

The browser write watcher now accepts CodeMirror's unchanged last-line
decoration class. The [failed main
run](https://github.com/max-sixty/leaf/actions/runs/37577351935)
reported `class on div.cm-line.lf-field-last` during otherwise passing
comment journeys. CodeMirror owns that class and reapplies it while
updating an editor view;
[#1871](#1871) deliberately uses
the decoration to reserve room for Send beside the last words. The
narrow watcher exception keeps the intended layout and continues to
report other unchanged writes.

`uv run pytest
tests/test_render_aim.py::test_the_aim_still_promises_while_a_composer_is_open
-q -n0` reproduced the teardown error before this change and passed
afterward. Other failures in the main run remain separate.

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