summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2009-01-06 22:43:06 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-01-06 22:43:06 +0100
commitd3eced6c5078ff7330383ee9317ac4f37389ac69 (patch)
tree2b6d7ea7ae938c457746cdf52a02354cec9c5b37
parentcf0b8753dadbcc6484b859a21544e437ef7d33eb (diff)
downloadmana-client-d3eced6c5078ff7330383ee9317ac4f37389ac69.tar.gz
mana-client-d3eced6c5078ff7330383ee9317ac4f37389ac69.tar.bz2
mana-client-d3eced6c5078ff7330383ee9317ac4f37389ac69.tar.xz
mana-client-d3eced6c5078ff7330383ee9317ac4f37389ac69.zip
Fix wrapping of UTF-8 multi-byte characters.
(cherry picked from commit 82182aeb9eacb3a6e10e34b34b46ef63222ecd7d)
-rw-r--r--src/gui/browserbox.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 80e41fc2..2706a4c4 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -392,7 +392,10 @@ BrowserBox::draw(gcn::Graphics *graphics)
continue;
}
- end--;
+ // Skip to the start of the current character
+ while ((row[end] & 192) == 128)
+ end--;
+ end--; // And then to the last byte of the previous one
part = row.substr(start, end - start + 1);
} while ((x + font->getWidth(part.c_str()) + 10) > getWidth());