mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix edge case where text breaking might result in too long string if
exactly 1 last symbol generated too long string
This commit is contained in:
@@ -124,7 +124,7 @@ std::vector<std::string> CMessage::breakText(std::string text, size_t maxLineWid
|
||||
|
||||
// not all line has been processed - it turned out to be too long, so erase everything after last word break
|
||||
// if string consists from a single word (or this is Chinese/Korean) - erase only last symbol to bring line back to allowed length
|
||||
if(currPos < text.length() && (text[currPos] != 0x0a))
|
||||
if(fontPtr->getStringWidth(printableString) > maxLineWidth && (text[currPos] != 0x0a))
|
||||
{
|
||||
if(wordBreak != ui32(-1))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user