1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 10:13:12 +02:00

core: add variables "_chat_focused_line_bol" and "_chat_focused_line_eol" in focus data (closes #1955)

These variables are the same as "_chat_bol" and "_chat_eol" except that they
stop at the beginning of the focused line (not the whole message displayed, in
case message has multiple lines separated by "\n").
This commit is contained in:
Sébastien Helleu
2023-06-17 10:03:04 +02:00
parent 54dd19da92
commit f62022e812
10 changed files with 93 additions and 20 deletions
+8
View File
@@ -72,6 +72,8 @@ gui_focus_get_info (int x, int y)
&focus_info->chat_line_x,
&focus_info->chat_word,
&focus_info->chat_focused_line,
&focus_info->chat_focused_line_bol,
&focus_info->chat_focused_line_eol,
&focus_info->chat_bol,
&focus_info->chat_eol);
@@ -102,6 +104,10 @@ gui_focus_free_info (struct t_gui_focus_info *focus_info)
free (focus_info->chat_word);
if (focus_info->chat_focused_line)
free (focus_info->chat_focused_line);
if (focus_info->chat_focused_line_bol)
free (focus_info->chat_focused_line_bol);
if (focus_info->chat_focused_line_eol)
free (focus_info->chat_focused_line_eol);
if (focus_info->chat_bol)
free (focus_info->chat_bol);
if (focus_info->chat_eol)
@@ -242,6 +248,8 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
}
HASHTABLE_SET_STR_NOT_NULL("_chat_word", focus_info->chat_word);
HASHTABLE_SET_STR_NOT_NULL("_chat_focused_line", focus_info->chat_focused_line);
HASHTABLE_SET_STR_NOT_NULL("_chat_focused_line_bol", focus_info->chat_focused_line_bol);
HASHTABLE_SET_STR_NOT_NULL("_chat_focused_line_eol", focus_info->chat_focused_line_eol);
HASHTABLE_SET_STR_NOT_NULL("_chat_bol", focus_info->chat_bol);
HASHTABLE_SET_STR_NOT_NULL("_chat_eol", focus_info->chat_eol);
+2
View File
@@ -32,6 +32,8 @@ struct t_gui_focus_info
int chat_line_x; /* x in line */
char *chat_word; /* word at (x,y) */
char *chat_focused_line; /* line at (x,y) */
char *chat_focused_line_bol; /* beg. of focused line until (x,y) */
char *chat_focused_line_eol; /* (x,y) until end of focused line */
char *chat_bol; /* beginning of line until (x,y) */
char *chat_eol; /* (x,y) until end of line */
struct t_gui_bar_window *bar_window; /* bar window found */
+22
View File
@@ -137,6 +137,8 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
int *line_x,
char **word,
char **focused_line,
char **focused_line_beginning,
char **focused_line_end,
char **beginning,
char **end)
{
@@ -150,6 +152,8 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
*line_x = -1;
*word = NULL;
*focused_line = NULL;
*focused_line_beginning = NULL;
*focused_line_end = NULL;
*beginning = NULL;
*end = NULL;
@@ -287,6 +291,24 @@ gui_window_get_context_at_xy (struct t_gui_window *window,
free (str_temp);
}
}
if (line_start)
{
str_temp = string_strndup (line_start, ptr_data - line_start);
if (str_temp)
{
*focused_line_beginning = gui_color_decode (str_temp, NULL);
free (str_temp);
}
}
if (line_end)
{
str_temp = string_strndup (ptr_data, line_end - ptr_data);
if (str_temp)
{
*focused_line_end = gui_color_decode (str_temp, NULL);
free (str_temp);
}
}
}
}
}
+2
View File
@@ -139,6 +139,8 @@ extern void gui_window_get_context_at_xy (struct t_gui_window *window,
int *line_x,
char **word,
char **focused_line,
char **focused_line_beginning,
char **focused_line_end,
char **beginning,
char **end);
extern void gui_window_ask_refresh (int refresh);