summaryrefslogtreecommitdiff
path: root/src/gui/gui-window.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-10-06 18:08:17 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-10-06 18:08:17 +0200
commitc77bccba870c0f85bb5168a3fb0a81103d98bf8a (patch)
tree0f65e8ead8bd7d570d5a07b5225b49d43bd72a8e /src/gui/gui-window.c
parentaf5951c123c5f55497a0c4961918563480a51d26 (diff)
parent93d2dbf3e1ef30e676a6edd56ab2b9bd2ddd70d9 (diff)
downloadweechat-c77bccba870c0f85bb5168a3fb0a81103d98bf8a.zip
Merge remote-tracking branch 'origin/pr/619'
Diffstat (limited to 'src/gui/gui-window.c')
-rw-r--r--src/gui/gui-window.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index 5506634e5..e18f74b13 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -139,7 +139,7 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
char **beginning,
char **end)
{
- int win_x, win_y;
+ int win_x, win_y, coords_x_message;
char *data_next_line, *str_temp;
const char *ptr_data, *word_start, *word_end, *last_space;
@@ -183,7 +183,11 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
if (!window->coords[win_y].data)
return;
- if (win_x < window->coords_x_message)
+ coords_x_message = gui_line_get_align ((*line)->data->buffer, *line, 0,
+ ((win_y > 0) &&
+ (window->coords[win_y - 1].line != *line)));
+
+ if (win_x < coords_x_message)
{
/* X is before message (time/buffer/prefix) */
if ((win_x >= window->coords[win_y].time_x1)
@@ -209,7 +213,7 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
&& (window->coords[win_y + 1].line == *line)) ?
window->coords[win_y + 1].data : NULL;
ptr_data = gui_chat_string_add_offset_screen (window->coords[win_y].data,
- win_x - window->coords_x_message);
+ win_x - coords_x_message);
if (ptr_data && ptr_data[0]
&& (!data_next_line || (ptr_data < data_next_line)))
{
@@ -670,7 +674,6 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer,
/* coordinates */
new_window->coords_size = 0;
new_window->coords = NULL;
- new_window->coords_x_message = 0;
/* tree */
new_window->ptr_tree = ptr_leaf;
@@ -970,7 +973,6 @@ gui_window_coords_alloc (struct t_gui_window *window)
gui_window_coords_init_line (window, i);
}
}
- window->coords_x_message = 0;
}
/*
@@ -2028,7 +2030,6 @@ gui_window_print_log ()
log_printf (" scroll. . . . . . . : 0x%lx", ptr_window->scroll);
log_printf (" coords_size . . . . : %d", ptr_window->coords_size);
log_printf (" coords. . . . . . . : 0x%lx", ptr_window->coords);
- log_printf (" coords_x_message. . : %d", ptr_window->coords_x_message);
log_printf (" ptr_tree. . . . . . : 0x%lx", ptr_window->ptr_tree);
log_printf (" prev_window . . . . : 0x%lx", ptr_window->prev_window);
log_printf (" next_window . . . . : 0x%lx", ptr_window->next_window);