1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

Fixed log problem with new color display system (now color codes are removed in

log file)
This commit is contained in:
Sebastien Helleu
2005-11-04 13:11:39 +00:00
parent 8a9e8ecc88
commit dd3977367f
10 changed files with 114 additions and 10 deletions
+12
View File
@@ -238,6 +238,18 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
}
break;
case GUI_ATTR_WEECHAT_COLOR_CHAR:
string++;
if (isdigit (string[0]) && isdigit (string[1]))
{
if (keep_colors)
{
out[out_pos++] = string[0];
out[out_pos++] = string[1];
}
string += 2;
}
break;
case GUI_ATTR_WEECHAT_SET_CHAR:
case GUI_ATTR_WEECHAT_REMOVE_CHAR:
string++;
+12 -2
View File
@@ -494,6 +494,7 @@ gui_new_line (t_gui_buffer *buffer)
new_line->line_with_message = 0;
new_line->line_with_highlight = 0;
new_line->data = NULL;
new_line->ofs_after_date = -1;
if (!buffer->lines)
buffer->lines = new_line;
else
@@ -601,10 +602,16 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
buffer->last_line->data = (char *) realloc (buffer->last_line->data,
strlen (buffer->last_line->data) +
strlen (message) + 1);
if (((type & MSG_TYPE_TIME) == 0) && (buffer->last_line->ofs_after_date < 0))
buffer->last_line->ofs_after_date = strlen (buffer->last_line->data);
strcat (buffer->last_line->data, message);
}
else
{
if (((type & MSG_TYPE_TIME) == 0) && (buffer->last_line->ofs_after_date < 0))
buffer->last_line->ofs_after_date = 0;
buffer->last_line->data = strdup (message);
}
length = gui_word_strlen (NULL, message);
buffer->last_line->length += length;
@@ -641,8 +648,11 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
}
if (buffer->line_complete && buffer->log_file && buffer->last_line->log_write)
{
log_write (buffer, buffer->last_line->data);
log_write (buffer, "\n");
if (buffer->last_line->ofs_after_date >= 0)
log_write_line (buffer,
buffer->last_line->data + buffer->last_line->ofs_after_date);
else
log_write_line (buffer, buffer->last_line->data);
}
}
+1
View File
@@ -203,6 +203,7 @@ struct t_gui_line
int line_with_message; /* line contains a message from a user? */
int line_with_highlight; /* line contains highlight */
char *data; /* line content */
int ofs_after_date; /* offset to first char after date */
t_gui_line *prev_line; /* link to previous line */
t_gui_line *next_line; /* link to next line */
};