Skip to content

Commit

Permalink
Fixed an issue RTL wrapped text calculates an extra line for the cont…
Browse files Browse the repository at this point in the history
…rol desired size (#17209)

* Always Return 0 bidi level for TextEndOfLine run

* Fix test unit

* Expand the unit test

---------

Co-authored-by: Benedikt Stebner <[email protected]>
Co-authored-by: Julien Lebosquain <[email protected]>
  • Loading branch information
3 people authored and maxkatz6 committed Oct 27, 2024
1 parent 782a313 commit c6914e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Avalonia.Base/Media/TextFormatting/BidiReorderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private static sbyte GetRunBidiLevel(TextRun run, FlowDirection flowDirection, s

if (run is TextEndOfLine)
{
return defaultLevel;
return 0;
}

if(previousLevel is not null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,15 @@ public void Should_Format_TextLine_With_Non_Text_TextRuns_RightToLeft()

Assert.Equal(14, textLine.Length);

var second = textLine.TextRuns[1] as ShapedTextRun;
var first = textLine.TextRuns[0] as ShapedTextRun;

Assert.NotNull(second);
var last = textLine.TextRuns[4] as TextEndOfParagraph;

Assert.Equal("Hello".AsMemory(), second.Text);
Assert.NotNull(first);

Assert.NotNull(last);

Assert.Equal("Hello".AsMemory(), first.Text);
}
}

Expand Down

0 comments on commit c6914e2

Please sign in to comment.