diff options
Diffstat (limited to 'src/gui/gui-common.c')
-rw-r--r-- | src/gui/gui-common.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c index 2f4c6163f..a471fe54d 100644 --- a/src/gui/gui-common.c +++ b/src/gui/gui-common.c @@ -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); } } |