mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 13:56:37 +02:00
gui: fix focus data being offset when prefix_align is none (closes #610)
window->coords_x_message stored a single x coordinate for the entire window which was used for message position calculation. Such approach does not work when prefix_align is none, thus now the x coordinate in question is exactly calculated for a line individually.
This commit is contained in:
@@ -1312,7 +1312,6 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
|
||||
{
|
||||
if (window->win_chat_cursor_y < window->coords_size)
|
||||
window->coords[window->win_chat_cursor_y].data = line->data->message;
|
||||
window->coords_x_message = window->win_chat_cursor_x;
|
||||
}
|
||||
|
||||
/* reset color & style for a new line */
|
||||
|
||||
@@ -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)))
|
||||
{
|
||||
@@ -645,7 +649,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;
|
||||
@@ -934,7 +937,6 @@ gui_window_coords_alloc (struct t_gui_window *window)
|
||||
gui_window_coords_init_line (window, i);
|
||||
}
|
||||
}
|
||||
window->coords_x_message = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1956,7 +1958,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);
|
||||
|
||||
@@ -76,7 +76,6 @@ struct t_gui_window
|
||||
/* coordinates (for focus) */
|
||||
int coords_size; /* size of coords (number of lines) */
|
||||
struct t_gui_window_coords *coords;/* coords for window */
|
||||
int coords_x_message; /* start X for messages */
|
||||
|
||||
/* tree */
|
||||
struct t_gui_window_tree *ptr_tree;/* pointer to leaf in windows tree */
|
||||
|
||||
Reference in New Issue
Block a user