Skip to content

Commit e913c89

Browse files
dme-compunetGillibaldMrJul
authored
Fixed an issue RTL wrapped text calculates an extra line for the control 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]>
1 parent d3aa0c2 commit e913c89

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Avalonia.Base/Media/TextFormatting/BidiReorderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private static sbyte GetRunBidiLevel(TextRun run, FlowDirection flowDirection, s
169169

170170
if (run is TextEndOfLine)
171171
{
172-
return defaultLevel;
172+
return 0;
173173
}
174174

175175
if(previousLevel is not null)

tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,15 @@ public void Should_Format_TextLine_With_Non_Text_TextRuns_RightToLeft()
156156

157157
Assert.Equal(14, textLine.Length);
158158

159-
var second = textLine.TextRuns[1] as ShapedTextRun;
159+
var first = textLine.TextRuns[0] as ShapedTextRun;
160160

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

163-
Assert.Equal("Hello".AsMemory(), second.Text);
163+
Assert.NotNull(first);
164+
165+
Assert.NotNull(last);
166+
167+
Assert.Equal("Hello".AsMemory(), first.Text);
164168
}
165169
}
166170

0 commit comments

Comments
 (0)