mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 15:26:00 +02:00
Fixed some of invalid utf8
This commit is contained in:
parent
0a51049d65
commit
f1257fb7fc
1 changed files with 11 additions and 0 deletions
|
@ -703,6 +703,11 @@ namespace Beefy.widgets
|
|||
EditWidgetContent.CharData* readPtr = &mData.mText[idx + 1];
|
||||
|
||||
int trailingBytes = UTF8.sTrailingBytesForUTF8[c];
|
||||
if (idx + trailingBytes + 1 >= mData.mTextLength)
|
||||
{
|
||||
return (c, 1);
|
||||
}
|
||||
|
||||
switch (trailingBytes)
|
||||
{
|
||||
case 4: c <<= 6; c += (uint8)(readPtr++).mChar; fallthrough;
|
||||
|
@ -3507,6 +3512,12 @@ namespace Beefy.widgets
|
|||
}
|
||||
if (movingDir > 0)
|
||||
{
|
||||
if ((useCharIdx == charIdx) && (c < (.)0xC0))
|
||||
{
|
||||
// This is an invalid UTF8 sequence
|
||||
break;
|
||||
}
|
||||
|
||||
useCharIdx++;
|
||||
mCursorTextPos++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue