Browse Source

Merge pull request #12171 from startewho/master

fix 12161
pull/12200/head
Max Katz 3 years ago
committed by GitHub
parent
commit
7d10558995
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      src/Avalonia.Controls/Utils/StringUtils.cs

22
src/Avalonia.Controls/Utils/StringUtils.cs

@ -76,7 +76,7 @@ namespace Avalonia.Controls.Utils
}
var codepoint = new Codepoint(text[index]);
if (!codepoint.IsWhiteSpace)
{
return false;
@ -85,12 +85,20 @@ namespace Avalonia.Controls.Utils
// preceeded by lwsp.
if (index > 0)
{
var nextCodePoint = new Codepoint(text[index + 1]);
if (index + 1 < text.Length)
{
var nextCodePoint = new Codepoint(text[index + 1]);
if (nextCodePoint.IsBreakChar)
if (nextCodePoint.IsBreakChar)
{
return true;
}
}
else
{
return true;
}
}
switch (codepoint.GeneralCategory)
@ -125,7 +133,7 @@ namespace Avalonia.Controls.Utils
}
cursor = Math.Min(cursor, text.Length);
int begin;
int i;
int cr;
@ -181,7 +189,7 @@ namespace Avalonia.Controls.Utils
{
return cursor;
}
if (cr < text.Length && text[cr] == '\r' && cr + 1 < text.Length && text[cr + 1] == '\n')
{
lf = cr + 1;
@ -214,9 +222,9 @@ namespace Avalonia.Controls.Utils
{
return i;
}
var cc = GetCharClass(text[i]);
// skip over the word, punctuation, or run of whitespace
while (i < cr && GetCharClass(text[i]) == cc)
{

Loading…
Cancel
Save