Fix client hanging when rendering text with small maximum width

Previously, when rendering text with a maximum width that is too small for a single glyph then the text rendering would loop indefinitely trying to advance the cursor to the next line where the glyph will also not fit.
This commit is contained in:
Robert Müller 2024-11-16 13:58:12 +01:00
parent aa408ef8c8
commit c3bcf57f99

View file

@ -1560,6 +1560,7 @@ public:
const char *pCurrent = pText; const char *pCurrent = pText;
const char *pEnd = pCurrent + Length; const char *pEnd = pCurrent + Length;
const char *pPrevBatchEnd = nullptr;
const char *pEllipsis = ""; const char *pEllipsis = "";
const SGlyph *pEllipsisGlyph = nullptr; const SGlyph *pEllipsisGlyph = nullptr;
if(pCursor->m_Flags & TEXTFLAG_ELLIPSIS_AT_END) if(pCursor->m_Flags & TEXTFLAG_ELLIPSIS_AT_END)
@ -1966,6 +1967,9 @@ public:
if(NewLine) if(NewLine)
{ {
if(pPrevBatchEnd == pBatchEnd)
break;
pPrevBatchEnd = pBatchEnd;
if(!StartNewLine()) if(!StartNewLine())
break; break;
GotNewLineLast = true; GotNewLineLast = true;