Skip to content

Size a message's fenced code to its lines, and let the draft's fences stand for its padding - #4273

Merged
max-sixty merged 3 commits into
mainfrom
thread-code-block-height
Oct 26, 2026
Merged

max-sixty merged 3 commits into
mainfrom
thread-code-block-height

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A one-line fenced code block in a thread message was 70px tall in both Chromium and Firefox, with 20px of that taken by its one line of text. The rest was a full code line (20px) of padding above and below the text, the 8px kept free for the sideways scrollbar, and the borders. #3486 added that padding so a sent message would be exactly as tall as its draft, where each ``` line takes a full line. Agent replies never had a draft, but they got the padding too.

A fenced block in a message now gets the 8px padding (--pre-pad-block) that every message code block already gets, so the same block is 46px. The draft still matches the sent message, now by the method in-place editing already used: a ``` line is as tall as that padding (8px) while the caret is elsewhere, and opens to a full line showing its backticks when the caret moves onto it. The in-place field still reads its display's own padding over this rule (readFaces).

Behavior change: typing a fence in a draft now moves the text below it by 12px when the caret leaves the ``` line.

Measured with leaf-dev probe, in both engines:

  • The sent block is 46px.
  • The draft's lines add up to the same 46px (opening fence line 8+1, code line 20, closing fence line 8+8+1).
  • The closing fence line grows to 29px when the caret moves onto it.

test_a_draft_draws_a_list_as_the_message_will already holds draft and message to one height with a fenced block in the draft. Without the draft rule it fails by 24px, 12px for each of the two fences.

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

max-sixty and others added 3 commits October 25, 2026 21:33
… stand for its padding

A one-line fenced code block in a thread message stood 70px tall, in
Chromium and Firefox alike: a code line of padding above and below its
one line (20 + 20 + 20), the 8px scrollbar clearance and its borders.
#3486 gave fenced code that padding so a sent message matched its draft,
where each fence keeps a full line. Agents' replies, which never had a
draft, paid for it too.

The message's fenced code now takes the padding every message pre has
(`--pre-pad-block`, 8px), so the same block is 46px. The draft lines up
with it the way in-place editing already did: a fence's line, while the
caret is away from it, is as tall as that padding, and grows to a full
line, showing its backticks, while the caret is on it. The in-place
field still reads its display's padding over this rule.

`test_a_draft_draws_a_list_as_the_message_will` holds draft and message
to one height with a fenced block in the draft; without the draft rule
it fails by the two fences' 12px each.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
# Conflicts:
#	dist/kernel/kernel.json
@max-sixty
max-sixty merged commit 0feaa2c into main Oct 26, 2026
4 checks passed
@max-sixty
max-sixty deleted the thread-code-block-height branch October 26, 2026 17:30
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