Repository navigation
officecanvas: words of different block-level elements are never one text box - #455
Merged
Merged
Conversation
…ext box A canvas joined a word to the previous text shape whenever it sat on the same baseline a short gap away. In a flex row that gap is the pill's padding, border and the row's gap, so the arrow after a pill joined the pill's text box and an editable PPTX drew it inside the pill. Canvas now implements paint.StructuredCanvas, notes the nearest non-phrasing element of each Mark, and joins only text of the same one. Known limit: an artifact mark carries no node (paint.Mark), so text a ::before generates in the next flex item still joins the item before it. handlayout-waiver: not a go-widgets application — officecanvas text-run join condition, existing line plus one clause; false positive reported Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
officecanvas.Canvas.Glyphsjoined a run to the previous text shape when it was on the same baseline and less than two font sizes away. The items of a flex row on one baseline (a pill, an arrow, a pill) are within that distance, so the arrow's text went into the pill's text box. Found through go-slides' editable PPTX export, where the arrow rendered inside the pill border.Fix
Canvasimplementspaint.StructuredCanvas(Mark). It records the nearest non-phrasing element of the node each text belongs to and joins runs only when that element is the same (or unknown: list markers, generated content, artifacts). Inline elements (b,span,a, ...) still flow with their parent, so a line with bold words stays one box.Known limits: text generated by
::beforein the next flex item still joins (artifact marks carry no node); and the mark carries the node, not its style, so aspanmade a flex item or block by CSS is still taken for inline.Tests
TestFlexItemsAreSeparateTextBoxesfails without the change (verified by revertingofficecanvas.go) and passes with it.go test ./...is green.🤖 Generated with Claude Code