Fix text wrapping regression
This commit is contained in:
@@ -201,25 +201,29 @@ void Font::ProcessText(const StringView& text, Array<FontLineCache>& outputLines
|
|||||||
moveLine = true;
|
moveLine = true;
|
||||||
if (lastWhitespaceIndex != INVALID_INDEX)
|
if (lastWhitespaceIndex != INVALID_INDEX)
|
||||||
{
|
{
|
||||||
// Back
|
|
||||||
cursorX = lastWhitespaceX;
|
cursorX = lastWhitespaceX;
|
||||||
tmpLine.LastCharIndex = lastWhitespaceIndex - 1;
|
tmpLine.LastCharIndex = lastWhitespaceIndex - 1;
|
||||||
currentIndex = lastWhitespaceIndex + 1;
|
nextCharIndex = currentIndex = lastWhitespaceIndex + 1;
|
||||||
nextCharIndex = currentIndex;
|
|
||||||
}
|
}
|
||||||
else if (lastUpperIndex != INVALID_INDEX)
|
else if (lastUpperIndex != INVALID_INDEX)
|
||||||
{
|
{
|
||||||
|
// Skip moving twice for the same character
|
||||||
|
if (outputLines.HasItems() && outputLines.Last().LastCharIndex == lastUpperIndex - 1)
|
||||||
|
{
|
||||||
|
currentIndex = nextCharIndex;
|
||||||
|
lastMoveLine = moveLine;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
cursorX = lastUpperX;
|
cursorX = lastUpperX;
|
||||||
tmpLine.LastCharIndex = lastUpperIndex - 1;
|
tmpLine.LastCharIndex = lastUpperIndex - 1;
|
||||||
currentIndex = lastUpperIndex + 1;
|
nextCharIndex = currentIndex = lastUpperIndex;
|
||||||
nextCharIndex = currentIndex;
|
|
||||||
}
|
}
|
||||||
else if (lastUnderscoreIndex != INVALID_INDEX)
|
else if (lastUnderscoreIndex != INVALID_INDEX)
|
||||||
{
|
{
|
||||||
cursorX = lastUnderscoreX;
|
cursorX = lastUnderscoreX;
|
||||||
tmpLine.LastCharIndex = lastUnderscoreIndex;
|
tmpLine.LastCharIndex = lastUnderscoreIndex - 2;
|
||||||
currentIndex = lastUnderscoreIndex + 1;
|
nextCharIndex = currentIndex = lastUnderscoreIndex + 1;
|
||||||
nextCharIndex = currentIndex;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user