diff options
-rw-r--r-- | src/gui/gui-buffer.c | 3 | ||||
-rw-r--r-- | src/gui/gui-line.c | 28 |
2 files changed, 24 insertions, 7 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index baebf72b5..52da85b27 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -579,6 +579,9 @@ gui_buffer_string_replace_local_var (struct t_gui_buffer *buffer, const char *pos_end_name; struct t_gui_buffer_local_var *ptr_local_var; + if (!string) + return NULL; + length = strlen (string) + 1; result = malloc (length); if (result) diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index 29404fecb..50aa07af7 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -361,7 +361,7 @@ int gui_line_has_highlight (struct t_gui_line *line) { int rc, i; - char *msg_no_color; + char *msg_no_color, *highlight_words; /* * highlights are disabled on this buffer? (special value "-" means that @@ -396,13 +396,27 @@ gui_line_has_highlight (struct t_gui_line *line) return 0; /* - * there is highlight on line if one of global highlight words matches line - * or one of buffer highlight words matches line + * there is highlight on line if one of buffer highlight words matches line + * or one of global highlight words matches line */ - rc = (string_has_highlight (msg_no_color, - CONFIG_STRING(config_look_highlight)) || - string_has_highlight (msg_no_color, - line->data->buffer->highlight_words)); + highlight_words = gui_buffer_string_replace_local_var (line->data->buffer, + line->data->buffer->highlight_words); + rc = string_has_highlight (msg_no_color, + (highlight_words) ? + highlight_words : line->data->buffer->highlight_words); + if (highlight_words) + free (highlight_words); + + if (!rc) + { + highlight_words = gui_buffer_string_replace_local_var (line->data->buffer, + CONFIG_STRING(config_look_highlight)); + rc = string_has_highlight (msg_no_color, + (highlight_words) ? + highlight_words : CONFIG_STRING(config_look_highlight)); + if (highlight_words) + free (highlight_words); + } free (msg_no_color); |