Browse Source

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 <Gillibald@users.noreply.github.com>
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
pull/17257/head
Compunet 1 year ago
committed by GitHub
parent
commit
e913c895ec
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      src/Avalonia.Base/Media/TextFormatting/BidiReorderer.cs
  2. 10
      tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs

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

@ -169,7 +169,7 @@ namespace Avalonia.Media.TextFormatting
if (run is TextEndOfLine)
{
return defaultLevel;
return 0;
}
if(previousLevel is not null)

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

@ -156,11 +156,15 @@ namespace Avalonia.Skia.UnitTests.Media.TextFormatting
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);
}
}

Loading…
Cancel
Save