WordWrapString: Fix state after starting a new line

After starting a new line, we restart the processing from the line break
position, so we need to set `nextCodepoint` correctly.

Fixes #3449
This commit is contained in:
Gleb Mazovetskiy 2021-11-09 23:04:54 +00:00
commit bc9031ad54
2 changed files with 3 additions and 2 deletions

View file

@ -327,6 +327,7 @@ std::string WordWrapString(string_view text, size_t width, GameFontTables size,
processedEnd = remaining.data();
lastBreakablePos = -1;
lineWidth = 0;
nextCodepoint = !remaining.empty() ? DecodeFirstUtf8CodePoint(remaining, &nextCodepointLen) : U'\0';
} while (!remaining.empty() && remaining[0] != '\0');
output.append(processedEnd, remaining.data());
return output;