mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 07:16:37 +02:00
Fix bug with URL selection in some terminals (caused by horizontal lines) (bug #27700)
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
@@ -159,6 +160,26 @@ gui_window_utf_char_valid (const char *utf_char)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user