mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-23 10:33:25 +01:00
Fix markup in multiline messages
A '<' or '>' at the beginning of a line will now highlight only this particular line instead of the whole message.
This commit is contained in:
parent
c6a2bb8a90
commit
d6fdac9739
@ -323,17 +323,27 @@ void line_info_print(ToxWindow *self)
|
||||
wprintw(win, "%s %s: ", user_settings->line_normal, line->name1);
|
||||
wattroff(win, COLOR_PAIR(nameclr));
|
||||
|
||||
if (line->msg[0] == '>')
|
||||
wattron(win, COLOR_PAIR(GREEN));
|
||||
else if (line->msg[0] == '<')
|
||||
wattron(win, COLOR_PAIR(RED));
|
||||
char* msg = line->msg;
|
||||
while (msg)
|
||||
{
|
||||
char* line = strsep(&msg, "\n");
|
||||
|
||||
wprintw(win, "%s", line->msg);
|
||||
if (line[0] == '>')
|
||||
wattron(win, COLOR_PAIR(GREEN));
|
||||
else if (line[0] == '<')
|
||||
wattron(win, COLOR_PAIR(RED));
|
||||
|
||||
if (line->msg[0] == '>')
|
||||
wattroff(win, COLOR_PAIR(GREEN));
|
||||
else if (line->msg[0] == '<')
|
||||
wattroff(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 (type == OUT_MSG && timed_out(line->timestamp, NOREAD_FLAG_TIMEOUT)) {
|
||||
wattron(win, COLOR_PAIR(RED));
|
||||
|
Loading…
Reference in New Issue
Block a user