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,13 +621,25 @@ _win_print_wrapped(WINDOW *win, const char * const message)
int curx = getcurx(win); int curx = getcurx(win);
int maxx = getmaxx(win); int maxx = getmaxx(win);
if (curx + strlen(word) > maxx) { // word larger than line
wprintw(win, "\n "); 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 ");
}
if (curx < 11) {
wprintw(win, " ");
}
wprintw(win, "%s", word);
} }
if (curx < 11) {
wprintw(win, " ");
}
wprintw(win, "%s", word);
} }
} }