From 72f587df0674a2dc9f173102772bd80bec711087 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 19 Jun 2008 12:21:11 +0200 Subject: [PATCH] Fix display bug with marker line when there's some filtered lines (marker was not displayed inside hidden lines) --- src/gui/curses/gui-curses-chat.c | 37 +++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index 6e966ab3a..1b9c3fe88 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -141,6 +141,37 @@ gui_chat_get_real_width (struct t_gui_window *window) return window->win_chat_width; } +/* + * gui_chat_marker_for_line: return 1 if marker must be displayed before this + * line, or 0 if it must not + */ + +int +gui_chat_marker_for_line (struct t_gui_buffer *buffer, struct t_gui_line *line) +{ + /* marker is not set for buffer? */ + if (!buffer->last_read_line) + return 0; + + /* marker is disabled in config? */ + if ((CONFIG_INTEGER(config_look_read_marker) != CONFIG_LOOK_READ_MARKER_LINE) + && (CONFIG_INTEGER(config_look_read_marker) != CONFIG_LOOK_READ_MARKER_DOTTED_LINE)) + return 0; + + line = line->prev_line; + while (line) + { + if (buffer->last_read_line == line) + return 1; + + if (line->displayed) + break; + + line = line->prev_line; + } + return 0; +} + /* * gui_chat_display_new_line: display a new line */ @@ -749,11 +780,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line, lines_displayed = 0; - marker_line = (((CONFIG_INTEGER(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_LINE) - || (CONFIG_INTEGER(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_DOTTED_LINE)) - && window->buffer->last_read_line - && (window->buffer->last_read_line == - gui_chat_get_prev_line_displayed (line))) ? 1 : 0; + marker_line = gui_chat_marker_for_line (window->buffer, line); if (marker_line) {