projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dd91b3d
)
More correct wrap_rows implementation
author
figec
<raptor.ext@gmail.com>
Fri, 19 Jun 2015 16:04:11 +0000
(19:04 +0300)
committer
est31
<MTest31@outlook.com>
Sat, 20 Jun 2015 01:41:51 +0000
(
03:41
+0200)
src/util/string.h
patch
|
blob
|
history
diff --git
a/src/util/string.h
b/src/util/string.h
index b4ce5743d777f99ab39da9e6b3d4e5b3d45f5cf9..6980060e43b060756c760f0cdff0f5cf2495a83c 100644
(file)
--- a/
src/util/string.h
+++ b/
src/util/string.h
@@
-426,18
+426,12
@@
inline std::string wrap_rows(const std::string &from,
{
std::string to;
- bool need_to_wrap = false;
-
size_t character_idx = 0;
for (size_t i = 0; i < from.size(); i++) {
- if (character_idx > 0 && character_idx % row_len == 0)
- need_to_wrap = true;
if (!IS_UTF8_MULTB_INNER(from[i])) {
- // Wrap string
if needed before next char started
- if (
need_to_wrap) {
+ // Wrap string
after last inner byte of char
+ if (
character_idx > 0 && character_idx % row_len == 0)
to += '\n';
- need_to_wrap = false;
- }
character_idx++;
}
to += from[i];