diff --git a/src/line_info.c b/src/line_info.c index 1bedfc5..b878a43 100644 --- a/src/line_info.c +++ b/src/line_info.c @@ -655,32 +655,21 @@ void line_info_print(ToxWindow *self) line->name1); wattroff(win, COLOR_PAIR(nameclr)); - char *msg = line->msg; - - while (msg) { - char *line = strsep(&msg, "\n"); - - if (line[0] == '>') { - wattron(win, COLOR_PAIR(GREEN)); - } else if (line[0] == '<') { - wattron(win, COLOR_PAIR(RED)); - } - - wprintw(win, "%s%c", line, msg ? '\n' : '\0'); - - if (line[0] == '>') { - wattroff(win, COLOR_PAIR(GREEN)); - } else if (line[0] == '<') { - wattroff(win, COLOR_PAIR(RED)); - } - - // change the \0 set by strsep back to \n - if (msg) { - msg[-1] = '\n'; - } + if (line->msg[0] == '>') { + wattron(win, COLOR_PAIR(GREEN)); + } else if (line->msg[0] == '<') { + wattron(win, COLOR_PAIR(RED)); } - wprintw(win, "\n", line->msg); + print_wrap(win, line, max_x, max_y); + + if (line->msg[0] == '>') { + wattroff(win, COLOR_PAIR(GREEN)); + } else if (line->msg[0] == '<') { + wattroff(win, COLOR_PAIR(RED)); + } + + waddch(win, '\n'); break; }