Repository navigation
fix(write): align a button or chip at the start of a line with the text margin (T-24) - #42
Conversation
…xt margin A pill is painted 0.55 em left of its first character, into the widened space before it. At the start of a line there is no space, so the pill hung past the text margin. A left-to-right, start-aligned paragraph, heading or quote line whose text starts with a chip or button is now inset by that 0.55 em (inside the quote bar and the step badge). The pill painter takes its em from the pill's text style, as the inset does, instead of from the caret height. Wonky-Task: T-24 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Wonky task: Linked to T-24: Buttons at the start of a line is slightly off the page.. |
|
All contributors have signed the CLA ✍️ ✅ |
Wonky task review: T-24: Buttons at the start of a line is slightly off the page.Screenshot: the description has an image of the changed UI. The pull request perfectly addresses the layout bug by calculating an inset for lines starting with pills and adjusting the pill painter coordinates. The tests added are exceptionally thorough, verifying correct geometry across all edge cases including undo/redo. No unrelated changes were made, and specs were cleanly updated.
Scope: Tests: Added. Excellent test coverage was added checking render box geometry for pills at start and middle of lines, as well as undo and redo. Specs: Updated. Section 7.2 of the Wonky Markdown spec was properly updated to reflect the new inset and margin logic for pills. Facts
Reviewed commit |
|
I have read the CLA Document and I hereby sign the CLA |
Wonky-Task: T-24
Wonky-Claim: 1EHS-TPEZ
Summary
A Wonky Markdown pill (button or chip) is painted 0.55 em left of its first character, into the widened space before it. At the start of a line there is no space before it, so the pill hung past the text margin. A left-to-right, start-aligned paragraph, heading or quote line whose text starts with a chip or button is now inset by that 0.55 em (
leadingPillInsetininline_pills.dart, applied inside the quote bar and the numbered-heading badge, so those don't move). The pill painter now takes its em from the pill's text style, the same value the inset uses, instead of from the caret height, so the two always agree. In the browser the size is the same as before (the caret is 1.2 em there).Spec updated:
specs/wonky_write/11-wonky-markdown.md§7.2.Known limit: a button that wraps onto the start of a later line in the middle of a paragraph still reaches 0.55 em past the margin. Indenting only that line would need a first-line indent, which Flutter text doesn't have.
Acceptance criteria
Test plan
dart analyzeanddart formatare cleanflutter testinwonky_write: 834 passed)wonky_write/test/features/editor/components/inline_pills_test.dart. It records the pill painter's actual draw calls and compares the pill's left edge with the left edge of a plain line, for a button, a secondary button and a chip at the start of a line (light and dark), a button in the middle of a line, and button → undo → redo./write/on localhost:8082) in light and dark: a button and a chip at the start of a line, a button in the middle of a line, a button in a callout, and undo and redo.🤖 Generated with Claude Code