From 7e25611234272081ae847a0388da84d09be3cb59 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 23 Dec 2013 14:02:23 +0300 Subject: in npc dialog allow correct split two byte characters. --- src/gui/widgets/extendedlistbox.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets/extendedlistbox.cpp') diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 0363b73a0..721a0a591 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -89,9 +89,12 @@ void ExtendedListBox::draw(gcn::Graphics *graphics) if (insideWidth < strWidth) { const int strSize = str.size(); + int divPos = strSize / 2; + if (divPos > 0 && (unsigned char)str[divPos - 1] >= 0xc0) + divPos --; list.push_back(ExtendedListBoxItem(row, - str.substr(0, strSize / 2), useImage, y)); - str = str.substr(strSize / 2); + str.substr(0, divPos), useImage, y)); + str = str.substr(divPos); y += height; useImage = false; } -- cgit v1.2.3-70-g09d2