1
0
mirror of https://github.com/minetest/minetest.git synced 2025-07-04 17:00:23 +02:00

Fix wrap_rows at inner byte of char

This commit is contained in:
figec
2015-06-18 21:34:17 +03:00
parent e45ecad3ab
commit 10140f2138

View File

@ -426,12 +426,19 @@ inline std::string wrap_rows(const std::string &from,
{ {
std::string to; std::string to;
bool need_to_wrap = false;
size_t character_idx = 0; size_t character_idx = 0;
for (size_t i = 0; i < from.size(); i++) { for (size_t i = 0; i < from.size(); i++) {
if (character_idx > 0 && character_idx % row_len == 0) if (character_idx > 0 && character_idx % row_len == 0)
need_to_wrap = true;
if (!IS_UTF8_MULTB_INNER(from[i])) {
if (need_to_wrap) {
to += '\n'; to += '\n';
if (!IS_UTF8_MULTB_INNER(from[i])) need_to_wrap = false;
}
character_idx++; character_idx++;
}
to += from[i]; to += from[i];
} }