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:
parent
fbda2b4170
commit
70501f5dbf
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user