Skip to content

Paragraph.getLineBoundary doesn't consider TextAffinity #87970

@justinmc

Description

@justinmc

ui.Paragraph.getLineBoundary gives an incorrect response when passed TextAffinity.downstream at a line wrap.

Example

Imagine we're rendering the string "123456789" and our field is very narrow and so the "9" wraps:

|12345678|
|9       |

There are now two TextPositions between the 8 and the 9, one on the first line and one on the second line:

First line: TextPosition(offset: 8, affinity: TextAffinity.upstream)
Second line: TextPosition(offset: 8, affinity: TextAffinity.downstream)

The problem is that getLineBoundary will return a TextRange of 0-8 regardless of which of the above two TextPositions are passed to it. It doesn't use the TextAffinity, only the index, which you can see in the code here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: typographyText rendering, possibly libtxtdependency: dartDart team may need to help usengineflutter/engine related. See also e: labels.found in release: 2.2Found to occur in 2.2found in release: 2.5Found to occur in 2.5has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions