diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-11-04 13:11:39 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-11-04 13:11:39 +0000 |
commit | dd3977367fa50d5f0d4fdb86534bb70415eeaa65 (patch) | |
tree | 988e6d41007b33fe872fa7d50fe1073fba9f50e5 /src/gui | |
parent | 8a9e8ecc885fe254234a42b692f8c2e20d5c24a5 (diff) | |
download | weechat-dd3977367fa50d5f0d4fdb86534bb70415eeaa65.zip |
Fixed log problem with new color display system (now color codes are removed in
log file)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-display.c | 12 | ||||
-rw-r--r-- | src/gui/gui-common.c | 14 | ||||
-rw-r--r-- | src/gui/gui.h | 1 |
3 files changed, 25 insertions, 2 deletions
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index bc9708367..9addeeab0 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -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++; 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); } } diff --git a/src/gui/gui.h b/src/gui/gui.h index 09f13dbca..fb69c9a35 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -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 */ }; |