diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-config.c | 17 | ||||
-rw-r--r-- | src/core/wee-config.h | 2 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-bar-window.c | 17 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-chat.c | 45 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-window.c | 20 | ||||
-rw-r--r-- | src/gui/curses/gui-curses.h | 1 |
6 files changed, 42 insertions, 60 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 8614adc02..f71d90cba 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -114,6 +114,7 @@ struct t_config_option *config_look_prefix_buffer_align_more; struct t_config_option *config_look_prefix_suffix; struct t_config_option *config_look_read_marker; struct t_config_option *config_look_read_marker_always_show; +struct t_config_option *config_look_read_marker_string; struct t_config_option *config_look_save_config_on_exit; struct t_config_option *config_look_save_layout_on_exit; struct t_config_option *config_look_scroll_amount; @@ -1514,9 +1515,9 @@ config_weechat_init_options () config_look_hline_char = config_file_new_option ( weechat_config_file, ptr_section, "hline_char", "string", - N_("char used to draw horizontal lines, note that empty value will " - "draw a real line with ncurses, but may cause bugs with URL " - "selection under some terminals"), + N_("char used to draw horizontal separators around bars (empty value " + "will draw a real line with ncurses, but may cause bugs with URL " + "selection under some terminals), wide chars are NOT allowed here"), NULL, 0, 0, "-", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); config_look_hotlist_names_count = config_file_new_option ( weechat_config_file, ptr_section, @@ -1694,13 +1695,19 @@ config_weechat_init_options () weechat_config_file, ptr_section, "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, 0, NULL, NULL, &config_change_read_marker, NULL, NULL, NULL); + "none|line|char", + 0, 0, "line", NULL, 0, NULL, NULL, &config_change_read_marker, NULL, NULL, NULL); config_look_read_marker_always_show = config_file_new_option ( weechat_config_file, ptr_section, "read_marker_always_show", "boolean", N_("always show read marker, even if it is after last buffer line"), NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + config_look_read_marker_string = config_file_new_option ( + weechat_config_file, ptr_section, + "read_marker_string", "string", + N_("string used to draw read marker line (string is repeated until " + "end of line)"), + NULL, 0, 0, "- ", NULL, 0, NULL, NULL, &config_change_read_marker, NULL, NULL, NULL); config_look_save_config_on_exit = config_file_new_option ( weechat_config_file, ptr_section, "save_config_on_exit", "boolean", diff --git a/src/core/wee-config.h b/src/core/wee-config.h index 9ab0df34a..e3052a87e 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -81,7 +81,6 @@ enum t_config_look_read_marker { CONFIG_LOOK_READ_MARKER_NONE = 0, CONFIG_LOOK_READ_MARKER_LINE, - CONFIG_LOOK_READ_MARKER_DOTTED_LINE, CONFIG_LOOK_READ_MARKER_CHAR, }; @@ -143,6 +142,7 @@ extern struct t_config_option *config_look_prefix_buffer_align_more; extern struct t_config_option *config_look_prefix_suffix; extern struct t_config_option *config_look_read_marker; extern struct t_config_option *config_look_read_marker_always_show; +extern struct t_config_option *config_look_read_marker_string; extern struct t_config_option *config_look_save_config_on_exit; extern struct t_config_option *config_look_save_layout_on_exit; extern struct t_config_option *config_look_scroll_amount; diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index 19e8c9223..c7b0ad7fc 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -552,7 +552,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, int chars_available, index, size; int length_screen_before_cursor, length_screen_after_cursor; int diff, max_length, optimal_number_of_lines; - int some_data_not_displayed; + int some_data_not_displayed, hline_char; if (!gui_init_ok) return; @@ -834,21 +834,28 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SEPARATOR])) { + if (CONFIG_STRING(config_look_hline_char) + && CONFIG_STRING(config_look_hline_char)[0]) + { + hline_char = utf8_char_int (CONFIG_STRING(config_look_hline_char)); + if (hline_char > 127) + hline_char = ACS_HLINE; + } + else + hline_char = ACS_HLINE; switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION])) { case GUI_BAR_POSITION_BOTTOM: gui_window_set_weechat_color (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator, GUI_COLOR_SEPARATOR); mvwhline (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator, - 0, 0, gui_window_get_hline_char (), - bar_window->width); + 0, 0, hline_char, bar_window->width); break; case GUI_BAR_POSITION_TOP: gui_window_set_weechat_color (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator, GUI_COLOR_SEPARATOR); mvwhline (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator, - 0, 0, gui_window_get_hline_char (), - bar_window->width); + 0, 0, hline_char, bar_window->width); break; case GUI_BAR_POSITION_LEFT: gui_window_set_weechat_color (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator, diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index a462631c4..c9e12b370 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -70,8 +70,7 @@ gui_chat_marker_for_line (struct t_gui_buffer *buffer, struct t_gui_line *line) struct t_gui_line *last_read_line; /* 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)) + if (CONFIG_INTEGER(config_look_read_marker) != CONFIG_LOOK_READ_MARKER_LINE) return 0; /* marker is not set for buffer? */ @@ -134,36 +133,26 @@ gui_chat_display_new_line (struct t_gui_window *window, int num_lines, int count void gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate) { - int i, n, hline_char; - - hline_char = gui_window_get_hline_char (); + int x, size_on_screen; if (!simulate) { - gui_window_set_weechat_color (GUI_WINDOW_OBJECTS(window)->win_chat, - GUI_COLOR_CHAT_READ_MARKER); - switch (CONFIG_INTEGER(config_look_read_marker)) + if (CONFIG_INTEGER(config_look_read_marker) == CONFIG_LOOK_READ_MARKER_LINE) { - case CONFIG_LOOK_READ_MARKER_LINE: - mvwhline (GUI_WINDOW_OBJECTS(window)->win_chat, - window->win_chat_cursor_y, window->win_chat_cursor_x, - hline_char, window->win_chat_width - 1); - break; - case CONFIG_LOOK_READ_MARKER_DOTTED_LINE: - wmove (GUI_WINDOW_OBJECTS(window)->win_chat, - window->win_chat_cursor_y, window->win_chat_cursor_x); - wclrtoeol (GUI_WINDOW_OBJECTS(window)->win_chat); - n = (window->win_chat_width % 2); - for (i = 0; i < window->win_chat_width - 1; i++) - { - if (i % 2 == n) - mvwhline (GUI_WINDOW_OBJECTS(window)->win_chat, - window->win_chat_cursor_y, i, - hline_char, 1); - } - break; - default: - break; + size_on_screen = utf8_strlen_screen (CONFIG_STRING(config_look_read_marker_string)); + gui_window_set_weechat_color (GUI_WINDOW_OBJECTS(window)->win_chat, + GUI_COLOR_CHAT_READ_MARKER); + wmove (GUI_WINDOW_OBJECTS(window)->win_chat, + window->win_chat_cursor_y, window->win_chat_cursor_x); + wclrtoeol (GUI_WINDOW_OBJECTS(window)->win_chat); + x = 0; + while (x < window->win_chat_width - 1) + { + mvwprintw (GUI_WINDOW_OBJECTS(window)->win_chat, + window->win_chat_cursor_y, x, + "%s", CONFIG_STRING(config_look_read_marker_string)); + x += size_on_screen; + } } window->win_chat_cursor_x = window->win_chat_width; } diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index ed5fcd71d..776b61186 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -145,26 +145,6 @@ gui_window_objects_free (struct t_gui_window *window, int free_separator) } /* - * gui_window_get_hline_char: get char used to draw horizontal lines - * Note: ACS_HLINE from ncurses is better for - * render, but it introduces bug with URLs - * selected by terminal: below this line, - * some URLs are not visible or shifted - */ - -int -gui_window_get_hline_char () -{ - const char *hline_char; - - hline_char = CONFIG_STRING(config_look_hline_char); - if (!hline_char || !hline_char[0]) - return ACS_HLINE; - - return utf8_char_int (hline_char); -} - -/* * gui_window_wprintw: decode then display string with wprintw */ diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h index 3fb339d57..69481bd78 100644 --- a/src/gui/curses/gui-curses.h +++ b/src/gui/curses/gui-curses.h @@ -80,7 +80,6 @@ extern int gui_keyboard_read_cb (void *data, int fd); /* window functions */ extern void gui_window_read_terminal_size (); extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer); -extern int gui_window_get_hline_char (); extern void gui_window_clear (WINDOW *window, int fg, int bg); extern void gui_window_reset_style (WINDOW *window, int num_color); extern void gui_window_set_color_style (WINDOW *window, int style); |