1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Fix handling of unknown characters with word wrap

This commit is contained in:
James Booth 2016-01-26 00:25:13 +00:00
parent 38dfdb9d84
commit 0501e49623

View File

@ -1195,7 +1195,11 @@ _win_print_wrapped(WINDOW *win, const char *const message, size_t indent, int pa
wordi = 0;
int wordlen = 0;
while (*curr_ch != ' ' && *curr_ch != '\n' && *curr_ch != '\0') {
size_t ch_len = mbrlen(curr_ch, 4, NULL);
size_t ch_len = mbrlen(curr_ch, MB_CUR_MAX, NULL);
if ((ch_len == (size_t)-2) || (ch_len == (size_t)-1)) {
curr_ch++;
continue;
}
int offset = 0;
while (offset < ch_len) {
word[wordi++] = curr_ch[offset++];