Skip to content
Snippets Groups Projects
Commit d7190df0 authored by figec's avatar figec Committed by est31
Browse files

More correct wrap_rows implementation

parent dd91b3d6
No related branches found
No related tags found
No related merge requests found
......@@ -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];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment