mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 21:23:01 +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);
|
wprintw(win, "%s %s: ", user_settings->line_normal, line->name1);
|
||||||
wattroff(win, COLOR_PAIR(nameclr));
|
wattroff(win, COLOR_PAIR(nameclr));
|
||||||
|
|
||||||
if (line->msg[0] == '>')
|
char* msg = line->msg;
|
||||||
wattron(win, COLOR_PAIR(GREEN));
|
while (msg)
|
||||||
else if (line->msg[0] == '<')
|
{
|
||||||
wattron(win, COLOR_PAIR(RED));
|
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] == '>')
|
wprintw(win, "%s%c", line, msg ? '\n' : '\0');
|
||||||
wattroff(win, COLOR_PAIR(GREEN));
|
|
||||||
else if (line->msg[0] == '<')
|
if (line[0] == '>')
|
||||||
wattroff(win, COLOR_PAIR(RED));
|
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)) {
|
if (type == OUT_MSG && timed_out(line->timestamp, NOREAD_FLAG_TIMEOUT)) {
|
||||||
wattron(win, COLOR_PAIR(RED));
|
wattron(win, COLOR_PAIR(RED));
|
||||||
|
Loading…
Reference in New Issue
Block a user