Browse Source

Fix GetLineIndexFromCharacterIndex

pull/4893/head
Benedikt Stebner 5 years ago
parent
commit
3f32f8e390
  1. 4
      src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs

4
src/Avalonia.Visuals/Media/TextFormatting/TextLayout.cs

@ -394,12 +394,12 @@ namespace Avalonia.Media.TextFormatting
{
var textLine = TextLines[index];
if (textLine.TextRange.End < charIndex)
if (textLine.TextRange.Start + textLine.TextRange.Length < charIndex)
{
continue;
}
if (charIndex >= textLine.Start && charIndex <= textLine.TextRange.End)
if (charIndex >= textLine.Start && charIndex <= textLine.TextRange.Start + textLine.TextRange.Length)
{
return index;
}

Loading…
Cancel
Save