summaryrefslogtreecommitdiff
path: root/src/gui/widgets/extendedlistbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-23 14:02:23 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-23 14:03:01 +0300
commit7e25611234272081ae847a0388da84d09be3cb59 (patch)
tree9684138030ccdaa24ebc5e9542f9b96da6360188 /src/gui/widgets/extendedlistbox.cpp
parent5a7c138016cf021361a21b7243f6124ea4855da8 (diff)
downloadmv-7e25611234272081ae847a0388da84d09be3cb59.tar.gz
mv-7e25611234272081ae847a0388da84d09be3cb59.tar.bz2
mv-7e25611234272081ae847a0388da84d09be3cb59.tar.xz
mv-7e25611234272081ae847a0388da84d09be3cb59.zip
in npc dialog allow correct split two byte characters.
Diffstat (limited to 'src/gui/widgets/extendedlistbox.cpp')
-rw-r--r--src/gui/widgets/extendedlistbox.cpp7
1 files changed, 5 insertions, 2 deletions
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;
}