diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-10-14 18:21:46 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-10-14 18:21:46 +0200 |
commit | a08842bbadacea3ff4f7506fcc14cb516f71cc1e (patch) | |
tree | b9b5102af573b006b6f9745e2e03af14da6e5d64 /src | |
parent | 37835df5731f72cda4dad15b27bff7addb96865d (diff) | |
download | weechat-a08842bbadacea3ff4f7506fcc14cb516f71cc1e.zip |
Fix bug with URL selection in some terminals (caused by horizontal lines) (bug #27700)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-config.c | 8 | ||||
-rw-r--r-- | src/core/wee-config.h | 1 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-bar-window.c | 12 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-chat.c | 9 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-window.c | 21 | ||||
-rw-r--r-- | src/gui/curses/gui-curses.h | 1 |
6 files changed, 44 insertions, 8 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 2b0e5c672..8c3ae6ab4 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -77,6 +77,7 @@ struct t_config_option *config_look_color_real_white; struct t_config_option *config_look_day_change; struct t_config_option *config_look_day_change_time_format; struct t_config_option *config_look_highlight; +struct t_config_option *config_look_hline_char; struct t_config_option *config_look_hotlist_names_count; struct t_config_option *config_look_hotlist_names_length; struct t_config_option *config_look_hotlist_names_level; @@ -1264,6 +1265,13 @@ config_weechat_init_options () N_("comma separated list of words to highlight (case insensitive " "comparison, words may begin or end with \"*\" for partial match)"), NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + 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"), + 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, "hotlist_names_count", "integer", diff --git a/src/core/wee-config.h b/src/core/wee-config.h index 021a503e1..0d1a550d8 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -92,6 +92,7 @@ extern struct t_config_option *config_look_color_real_white; extern struct t_config_option *config_look_day_change; extern struct t_config_option *config_look_day_change_time_format; extern struct t_config_option *config_look_highlight; +extern struct t_config_option *config_look_hline_char; extern struct t_config_option *config_look_hotlist_names_count; extern struct t_config_option *config_look_hotlist_names_length; extern struct t_config_option *config_look_hotlist_names_level; diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index 768a00d9e..5e96381d1 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -405,7 +405,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, int length_on_screen, chars_available; int length_screen_before_cursor, length_screen_after_cursor; int total_length_screen, diff, max_length, optimal_number_of_lines; - int some_data_not_displayed; + int some_data_not_displayed, hline_char; if (!gui_init_ok) return; @@ -615,6 +615,8 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, wnoutrefresh (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar); + hline_char = gui_window_get_hline_char (); + if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SEPARATOR])) { switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION])) @@ -622,14 +624,16 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, 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, ACS_HLINE, - bar_window->width); + mvwhline (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator, 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, ACS_HLINE, 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 aac84aad1..f4bd74224 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -128,7 +128,9 @@ 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; + int i, n, hline_char; + + hline_char = gui_window_get_hline_char (); if (!simulate) { @@ -139,8 +141,7 @@ gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate) case CONFIG_LOOK_READ_MARKER_LINE: mvwhline (GUI_WINDOW_OBJECTS(window)->win_chat, window->win_chat_cursor_y, window->win_chat_cursor_x, - ACS_HLINE, - window->win_chat_width - 1); + hline_char, window->win_chat_width - 1); break; case CONFIG_LOOK_READ_MARKER_DOTTED_LINE: wmove (GUI_WINDOW_OBJECTS(window)->win_chat, @@ -152,7 +153,7 @@ gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate) if (i % 2 == n) mvwhline (GUI_WINDOW_OBJECTS(window)->win_chat, window->win_chat_cursor_y, i, - ACS_HLINE, 1); + hline_char, 1); } break; default: diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 2db24ab52..823969071 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -34,6 +34,7 @@ #include "../../core/wee-hook.h" #include "../../core/wee-log.h" #include "../../core/wee-string.h" +#include "../../core/wee-utf8.h" #include "../../plugins/plugin.h" #include "../gui-window.h" #include "../gui-bar.h" @@ -160,6 +161,26 @@ gui_window_utf_char_valid (const char *utf_char) } /* + * 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 70f89b5cc..30ac8f71d 100644 --- a/src/gui/curses/gui-curses.h +++ b/src/gui/curses/gui-curses.h @@ -77,6 +77,7 @@ extern int gui_keyboard_read_cb (void *data, int fd); extern void gui_window_read_terminal_size (); extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer); extern int gui_window_utf_char_valid (const char *utf_char); +extern int gui_window_get_hline_char (); extern void gui_window_clear (WINDOW *window, int bg); extern void gui_window_reset_style (WINDOW *window, int num_color); extern void gui_window_set_color_style (WINDOW *window, int style); |