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,6 +621,17 @@ _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);
|
||||||
|
|
||||||
|
// 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) {
|
if (curx + strlen(word) > maxx) {
|
||||||
wprintw(win, "\n ");
|
wprintw(win, "\n ");
|
||||||
}
|
}
|
||||||
@ -630,6 +641,7 @@ _win_print_wrapped(WINDOW *win, const char * const message)
|
|||||||
wprintw(win, "%s", word);
|
wprintw(win, "%s", word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(word);
|
free(word);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user