diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-27 20:44:14 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-27 20:44:14 +0200 |
commit | c78fabde1f572f28e0b1f2f71f358606ac943c01 (patch) | |
tree | a0be59adcdc21262d2d742bf479161aa8d928181 /src | |
parent | ba37b555a3d2c5305196f16e3d07e248ace5c81c (diff) | |
download | weechat-c78fabde1f572f28e0b1f2f71f358606ac943c01.zip |
Added marker line (or dotted line), more visible than single magenta char (char is still possible)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-config.c | 12 | ||||
-rw-r--r-- | src/core/wee-config.h | 5 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-chat.c | 105 |
3 files changed, 91 insertions, 31 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c index d62667351..162d747aa 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -1041,10 +1041,10 @@ config_weechat_init () NULL, 0, 0, "%a, %d %b %Y", NULL, NULL, NULL, NULL, NULL, NULL); config_look_read_marker = config_file_new_option ( weechat_config_file, ptr_section, - "read_marker", "string", - N_("use a marker on servers/channels to show first unread " - "line"), - NULL, 0, 1, " ", NULL, NULL, &config_change_read_marker, NULL, NULL, NULL); + "read_marker", "integer", + N_("use a marker (line or char) on buffers to show first unread line"), + "none|line|dotted-line|char", + 0, 0, "dotted-line", NULL, NULL, &config_change_read_marker, NULL, NULL, NULL); config_look_input_format = config_file_new_option ( weechat_config_file, ptr_section, "input_format", "string", @@ -1280,13 +1280,13 @@ config_weechat_init () weechat_config_file, ptr_section, "chat_read_marker", "color", N_("text color for unread data marker"), - NULL, GUI_COLOR_CHAT_READ_MARKER, 0, "yellow", + NULL, GUI_COLOR_CHAT_READ_MARKER, 0, "magenta", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_read_marker_bg = config_file_new_option ( weechat_config_file, ptr_section, "chat_read_marker_bg", "color", N_("background color for unread data marker"), - NULL, -1, 0, "magenta", NULL, NULL, &config_change_color, NULL, NULL, NULL); + NULL, -1, 0, "default", NULL, NULL, &config_change_color, NULL, NULL, NULL); /* status window */ config_color_status = config_file_new_option ( weechat_config_file, ptr_section, diff --git a/src/core/wee-config.h b/src/core/wee-config.h index c2bc989da..47b81ffb5 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -40,6 +40,11 @@ #define CONFIG_LOOK_HOTLIST_SORT_NUMBER_ASC 4 #define CONFIG_LOOK_HOTLIST_SORT_NUMBER_DESC 5 +#define CONFIG_LOOK_READ_MARKER_NONE 0 +#define CONFIG_LOOK_READ_MARKER_LINE 1 +#define CONFIG_LOOK_READ_MARKER_DOTTED_LINE 2 +#define CONFIG_LOOK_READ_MARKER_CHAR 3 + extern struct t_config_file *weechat_config_file; extern struct t_config_section *weechat_config_section_bar; diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index 6855065ab..642aa2570 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -166,6 +166,47 @@ gui_chat_display_new_line (struct t_gui_window *window, int num_lines, int count } /* + * gui_chat_display_horizontal_line: display an horizontal line (marker for + * data not read) + */ + +void +gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate) +{ + int i; + + if (!simulate) + { + gui_window_set_weechat_color (GUI_CURSES(window)->win_chat, + GUI_COLOR_CHAT_READ_MARKER); + switch (CONFIG_INTEGER(config_look_read_marker)) + { + case CONFIG_LOOK_READ_MARKER_LINE: + mvwhline (GUI_CURSES(window)->win_chat, + window->win_chat_cursor_y, window->win_chat_cursor_x, + ACS_HLINE, + window->win_chat_width); + break; + case CONFIG_LOOK_READ_MARKER_DOTTED_LINE: + wmove (GUI_CURSES(window)->win_chat, + window->win_chat_cursor_y, window->win_chat_cursor_x); + wclrtoeol (GUI_CURSES(window)->win_chat); + for (i = 0; i < window->win_chat_width; i++) + { + if (i % 2 != 0) + mvwhline (GUI_CURSES(window)->win_chat, + window->win_chat_cursor_y, i, + ACS_HLINE, 1); + } + break; + default: + break; + } + window->win_chat_cursor_x = window->win_chat_width; + } +} + +/* * gui_chat_string_next_char: returns next char of a word (for display) * special chars like colors, bold, .. are skipped * and optionaly applied @@ -648,7 +689,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line, int count, int simulate) { int num_lines, x, y, lines_displayed, line_align; - int read_marker_x, read_marker_y; + int read_marker_x, read_marker_y, marker_line; int word_start_offset, word_end_offset; int word_length_with_spaces, word_length; char *ptr_data, *ptr_end_offset, *next_char; @@ -682,6 +723,20 @@ 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; + + if (marker_line) + { + gui_chat_display_horizontal_line (window, simulate); + gui_chat_display_new_line (window, num_lines, count, + &lines_displayed, simulate); + lines_displayed--; + } + /* display time and prefix */ gui_chat_display_time_and_prefix (window, line, num_lines, count, &lines_displayed, simulate); @@ -779,38 +834,38 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line, } else { - if (CONFIG_STRING(config_look_read_marker) - && CONFIG_STRING(config_look_read_marker)[0]) + /* display marker if line is matching user search */ + if (window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED) { - /* display marker if line is matching user search */ - if (window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED) + if (gui_chat_line_search (line, window->buffer->input_buffer, + window->buffer->text_search_exact)) { - if (gui_chat_line_search (line, window->buffer->input_buffer, - window->buffer->text_search_exact)) - { - gui_window_set_weechat_color (GUI_CURSES(window)->win_chat, - GUI_COLOR_CHAT_READ_MARKER); - mvwprintw (GUI_CURSES(window)->win_chat, - read_marker_y, read_marker_x, - "%c", CONFIG_STRING(config_look_read_marker)[0]); - } + gui_window_set_weechat_color (GUI_CURSES(window)->win_chat, + GUI_COLOR_CHAT_READ_MARKER); + mvwprintw (GUI_CURSES(window)->win_chat, + read_marker_y, read_marker_x, + "*"); } - else + } + else + { + /* display read marker if needed */ + if ((CONFIG_INTEGER(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_CHAR) + && window->buffer->last_read_line + && (window->buffer->last_read_line == gui_chat_get_prev_line_displayed (line))) { - /* display read marker if needed */ - if (window->buffer->last_read_line && - (window->buffer->last_read_line == gui_chat_get_prev_line_displayed (line))) - { - gui_window_set_weechat_color (GUI_CURSES(window)->win_chat, - GUI_COLOR_CHAT_READ_MARKER); - mvwprintw (GUI_CURSES(window)->win_chat, - read_marker_y, read_marker_x, - "%c", CONFIG_STRING(config_look_read_marker)[0]); - } + gui_window_set_weechat_color (GUI_CURSES(window)->win_chat, + GUI_COLOR_CHAT_READ_MARKER); + mvwprintw (GUI_CURSES(window)->win_chat, + read_marker_y, read_marker_x, + "*"); } } } + if (marker_line) + lines_displayed++; + return lines_displayed; } |