Skip to content

Preserve line breaks when sending a card reply - #3824

Merged
max-sixty merged 8 commits into
mainfrom
comment-box-followups
Oct 28, 2026
Merged

max-sixty merged 8 commits into
mainfrom
comment-box-followups

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A reply typed in a margin card changed its line breaks when sent because the editor and sent message reserved different space beside Send. They now share the comment box's spacing rules, so the words keep the same line breaks through submission.

On desktop, the empty card reply field becomes 32px tall instead of 40px, and the sent-message text column narrows by 3px. The initial comment box and card replies use the same Send inset; panel and page reply widths retain their existing design.

Validation covers actual word positions before and after Send for mouse and touch, growing reply fields, and inherited spacing. The rendered before/after was reviewed and approved. Selection shading and brackets are existing behavior and are outside this change.

This was written by Codex on behalf of max-sixty

max-sixty and others added 6 commits October 24, 2026 00:27
Typing a space after the last word of a draft could pull that word back up
a line. The field kept Send's room after its last words only, as an inline
spacer after the last line; #3678 glued the spacer to the last word with a
no-break space, so a word that fit only without the room wrapped together
with it, and a typed space opened a break between them that let the word
rise again. Before #3678 the spacer could instead wrap alone and leave the
word under Send. Each mode beside it (every line under a finger, every line
while the field scrolls) was another branch where wrapping depended on
state other than the words.

The field now keeps the room as end padding on every line, the one mode
the coarse-pointer and scrolling cases already used, and the anchored
comment box already used for every pointer. Where a draft wraps turns on
the words and the box's width alone. This removes the last-line
decoration, the glued variant, the `endRoom` reading and the panel's
`data-lf-end-room-glued`. It reverses the 15 October choice to let the
panel's lines above the last run under Send's column; at the user's
direction, every line now gives up that room (26px in the panel, more in a
card's reply box) for wrapping no keystroke at the end can change.

CodeMirror's `break-spaces` also moved a word: a space typed after a word
ending at the row's edge took room on that row and carried the word down
with it. The field and the sent message's paragraphs now use `pre-wrap`,
where a line-end space hangs, as in a textarea. Messages whose words end
within a space of the edge wrap a word later than before.

A user's sent message keeps the column of the reply box it was written
in, so it now ends Send's room short of its edge too: by default
`--lf-compose-send-end` (Send's hit box and its insets), which the reply
box's room is now stated from, as lf-diff and visual-review threads use.
The panel's sent reply kept the field's width by a sum that held only
under a mouse; it now counts the room, both of the row's seats and its
padding, so a reply rewraps neither under a mouse nor a finger. A margin
card's messages keep the anchored comment box's end, so a reply typed in
the card still rewraps when sent, as it did before.

Tests: `test_a_space_after_the_last_word_moves_no_word` types the reported
comment a word at a time and presses Space after each, in Chromium and
Firefox; on main it fails at "...strong view". It replaces the test of
the scrolling mode, and the touch test of the glued spacer goes with it.
The panel row test now holds every line short of Send, and the journey
test of Shift+Enter under a full last line, whose room no longer takes a
line of its own, now checks that typing on an opened line leaves the
words above at rest where they were.

> _This was written by Claude Code on behalf of max-sixty_

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
A reply typed in a margin card rewrapped when sent. The card's messages
ended their words 30px short of its edge, matching the anchored comment
box the card grew from, while its reply box ended them 41px short: Send
stood at the composer's 6px action inset in a 40px field. A word ending
in that 11px band moved to another line once sent.

The comment box, the card and the card's reply box now share one Send
corner. Both surfaces set `--lf-compose-action-inset` to the gap that
centres Send in a line, and restate the field height and text end that
derive from it, so the card's reply box is the comment box's 32px field
with Send 2px from its corner, and every column ends its words at
`--lf-compose-send-end`. `--lf-comment-text-end`, `--lf-comment-send-inset`
and the comment box's own Send placement are gone.

Behavior changes, under a mouse (a finger's larger Send moves each by
its own sizes):
- A card's reply box is 32px tall at rest (was 40px) and its words end
  33px short of the edge (was 41px); the card's reply row shrinks to match.
- The comment box and every message in a card end their words 33px short
  of the edge (was 30px), 2px clear of Send's face rather than touching it.

The new test types a reply in a card and sends it, under a mouse and a
finger, and fails on the previous styles. Two tests that read the old
geometry now read the new one.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	browser/shadow.css
#	browser/styles/components/response.css
leaf-agent
leaf-agent previously approved these changes Oct 24, 2026
@max-sixty max-sixty changed the title Give a card's reply box the comment box's Send corner Preserve line breaks when sending a card reply Oct 28, 2026
@max-sixty
max-sixty merged commit 8429db5 into main Oct 28, 2026
5 checks passed
@max-sixty
max-sixty deleted the comment-box-followups branch October 28, 2026 23:18
leaf-agent added a commit that referenced this pull request Oct 29, 2026
The compact-comment test still expected its text column to end exactly
at Send's hit box. #3824 intentionally changed comment, card and
card-reply spacing to preserve line breaks through submission; the
current 3px gap is the action inset plus the frame around the field. The
assertion now accounts for that shared spacing rather than rejecting it.
The 0.1px tolerance, motion-completion wait and trailing-space
height/position checks remain in place. This changes only the test.

The focused test reproduces `292 == 295 ± 0.1` before this change and
passes afterward, both normally and at 6× CPU throttling. The failure
screenshot was inspected; no runtime or visual behavior is changed. CI
and review remain pending.

Closes #4467 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 30, 2026
…under a mouse

drafts/test_send_corner.py follows the card's reply box in Chromium and
Firefox and the panel's field in Chromium: Send hides once the words
reach it and they run under its column; on a paused clock a press 1 ms
short of the rest reaches the words, and one after it sends. It fails
with the rest cut to 0 ms and with the panel keeping its room.

The line-break test now also holds a comment's lines from the comment
box into the card. The panel row test and the compact comment test
asserted the room Send kept on every line, which under a mouse the
words now take; the compact test's room for touch already failed on
main by 3px since #3824.

Under a mouse an empty card reply box is one row tall, its frame
included, so the card's reserved reply row drops its extra 2px, which
had let the draft jump up 2px at its first wrap.
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