word_wrap: hack to workaround long lines without spaces

This commit is contained in:
Brad Parker 2018-08-09 23:54:16 -04:00
parent e235a0991c
commit fe6dda917a

View File

@ -159,6 +159,7 @@ char *word_wrap(char* buffer, const char *string, int line_width, bool unicode)
while (i < len)
{
unsigned counter;
int pos = &buffer[i] - buffer;
/* copy string until the end of the line is reached */
for (counter = 1; counter <= (unsigned)line_width; counter++)
@ -214,6 +215,9 @@ char *word_wrap(char* buffer, const char *string, int line_width, bool unicode)
i = k + 1;
break;
}
if (&buffer[i] - buffer == pos)
return buffer;
}
}