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

Wordwrap, handle words bigger than line space

This commit is contained in:
James Booth 2014-11-09 23:05:53 +00:00
parent fbda2b4170
commit 70501f5dbf

View File

@ -621,6 +621,17 @@ _win_print_wrapped(WINDOW *win, const char * const message)
int curx = getcurx(win);
int maxx = getmaxx(win);
// word larger than line
if (strlen(word) > (maxx - 11)) {
int i;
for (i = 0; i < wordi; i++) {
curx = getcurx(win);
if (curx < 11) {
wprintw(win, " ");
}
waddch(win, word[i]);
}
} else {
if (curx + strlen(word) > maxx) {
wprintw(win, "\n ");
}
@ -630,6 +641,7 @@ _win_print_wrapped(WINDOW *win, const char * const message)
wprintw(win, "%s", word);
}
}
}
free(word);
}