Skip to content

Commit d7190df

Browse files
figecest31
figec
authored andcommittedJun 20, 2015
More correct wrap_rows implementation
1 parent dd91b3d commit d7190df

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed
 

‎src/util/string.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -426,18 +426,12 @@ inline std::string wrap_rows(const std::string &from,
426426
{
427427
std::string to;
428428

429-
bool need_to_wrap = false;
430-
431429
size_t character_idx = 0;
432430
for (size_t i = 0; i < from.size(); i++) {
433-
if (character_idx > 0 && character_idx % row_len == 0)
434-
need_to_wrap = true;
435431
if (!IS_UTF8_MULTB_INNER(from[i])) {
436-
// Wrap string if needed before next char started
437-
if (need_to_wrap) {
432+
// Wrap string after last inner byte of char
433+
if (character_idx > 0 && character_idx % row_len == 0)
438434
to += '\n';
439-
need_to_wrap = false;
440-
}
441435
character_idx++;
442436
}
443437
to += from[i];

0 commit comments

Comments
 (0)
Please sign in to comment.