From 01e4eb1b8ce996e32feca70580861c2ef53fbb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Mon, 10 Jul 2023 17:44:49 +0200 Subject: [PATCH] Fix text wrapping with long Unicode strings Rewind one unicode codepoint instead of rewinding only one character (byte) when text does not fit. Closes #6810. --- src/engine/client/text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index 35ead4ebe..428aabf14 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -1214,7 +1214,7 @@ public: Cutter.m_Flags |= TEXTFLAG_STOP_AT_END | TEXTFLAG_DISALLOW_NEWLINE; TextEx(&Cutter, pCurrent, Wlen); - Wlen = maximum(Cutter.m_CharCount - 1, 0); + Wlen = str_utf8_rewind(pCurrent, Cutter.m_CharCount); // rewind once to skip the last character that did not fit NewLine = true; if(Cutter.m_GlyphCount <= 3 && !GotNewLineLast) // if we can't place 3 chars of the word on this line, take the next