fix(chat): the seen gutter only on the message with faces beside its text, as wide as its stack
Regression
#671 kept a fixed right gutter on every message's text (88px, 60px on a phone), so the faces of a faces-only message could sit beside the last line. Every message's text wrapped early for nothing, leaving an empty column on the right, worst in narrow panes.
Fix
- Only the message whose faces sit beside its text keeps a gutter. That's a faces-only message whose faces row follows the text directly, so the last message of a run.
- The gutter is sized to that message's stack + 12px (
facesGutter,web/features/chat/model.ts):- the button's 4px each side, 20px for the first face, 14px for each next face or "+N", 13px for the ✓
- rounded up to the 4px scale: 40px for one face, up to 96px for 3 faces + "+N" + ✓
- phone: 1 face + "+N", so at most 68px
- It's a class table, not an inline style (style policy).
footerFaceCountshares the footer's dedupe, so the gutter and the stack can't disagree.- Every other message's text has the full width.
Why not a gutter on the last line only (float/spacer): it only works when the text ends in a paragraph or list, not with code blocks, tables, quotes or chips. It's also what produced the "faces squeezed against the text" look that was rejected before #671. The per-message rule works for any content.
Numbers (DOM measurement, local dev, same seed)
Text column width:
main (a2200e97) | this PR | |
|---|---|---|
| room 1440, message without faces | 487px (88px gutter) | 575px (no gutter) |
| room 1440, faces-only, one face | 487px | 535px (40px gutter) |
| room 1440, faces-only, 1 face + ✓ | 487px | 519px (56px) |
| room 1440, faces-only, 3 faces + "+2" | 487px | 491px (84px) |
| thread 1440, message without faces | 487px | 575px |
| thread 1440, faces-only, 2 faces + ✓ | 487px | 507px (68px) |
| phone 390, message without faces | 218px (60px gutter) | 278px |
| phone 390, faces-only | 218px | 222–238px |
- Space from the text column to the faces: 16–19px everywhere. Main had 9px for 2 faces + ✓ on a phone.
- No overlap: the faces cover no glyph.
- Spacing unchanged: 24px between groups (after nothing, choices, faces or a chips row) and 6px in runs, at 1440 and 390.
- Hover: no message moves.
Screens
| before (main) | after |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
Thread on a phone: before · after
Tests
scripts/chat.test.ts:facesGutterwidths (none, one face, ✓, five faces desktop/phone) andfooterFaceCountdedupe.scripts/ui-panels.test.ts: only the faces-only messages get a gutter, of their size; the others don't.bun run checkpasses (includes the chat DOM tests).bun run test:design-systempasses.
🤖 Generated with Claude Code
Summary by cubic
Fixes the regression from #671 where every message's text kept a fixed right gutter (88px on desktop, 60px on phone), forcing unnecessary early text wrapping and leaving an empty column in narrow panes. Now only a faces-only message whose faces sit beside its text keeps a gutter, sized to its face stack plus 12px; all other messages' text gets the full width.
facesGutterinweb/features/chat/model.tsreturns Tailwind classes for gutter widths (40px for one face, up to 96px for three faces, "+N", and the ✓; one face and "+N" on a phone), as a class table rather than inline styles.footerFaceCountdedupes readers who also passed, so the gutter width always matches the stack drawn.- Updated chat and ui-panels tests to verify gutters appear only on faces-only messages and are sized to their stacks.





