1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 14:26:39 +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
+1
View File
@@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele
New features::
* core: add variables "_chat_focused_line_bol" and "_chat_focused_line_eol" in focus data (issue #1955)
* api: add info "buffer" (issue #1962)
Bug fixes::
+10 -4
View File
@@ -12902,7 +12902,7 @@ This function is not available in scripting API.
==== hook_focus
_Updated in 1.5._
_Updated in 1.5, 4.0.0, 4.1.0._
Hook a focus: mouse event or key pressed in cursor mode (free movement of
cursor).
@@ -13017,16 +13017,22 @@ Content of hashtable sent to callback (keys and values are of type "string"):
| _chat_line_message | Message of line.
| "Hello world!" | ""
| _chat_focused_line | Line at (x,y) _(WeeChat ≥ 4.0.0)_.
| _chat_focused_line | Line at (x, y) _(WeeChat ≥ 4.0.0)_.
| "Hello world!" | ""
| _chat_focused_line_bol | Text from beginning of line to (x-1, y) _(WeeChat ≥ 4.1.0)_.
| "Hello" | ""
| _chat_focused_line_eol | Text from (x, y) to end of line _(WeeChat ≥ 4.1.0)_.
| "llo world!" | ""
| _chat_word | Word at (x,y).
| "Hello" | ""
| _chat_bol | Text from beginning of line to (x-1, y).
| _chat_bol | Text from beginning of message to (x-1, y).
| "He" | ""
| _chat_eol | Text from (x, y) to the end of line.
| _chat_eol | Text from (x, y) to the end of message.
| "llo world!" | ""
| _bar_name | Name of bar.
+10 -4
View File
@@ -13192,7 +13192,7 @@ Cette fonction n'est pas disponible dans l'API script.
==== hook_focus
_Mis à jour dans la 1.5._
_Mis à jour dans la 1.5, 4.0.0, 4.1.0._
Accrocher un focus : évènement souris ou touche du clavier pressée dans le mode
"curseur" (mouvement libre du curseur).
@@ -13312,16 +13312,22 @@ valeurs sont de type "string") :
| _chat_line_message | Message de la ligne.
| "Hello world!" | ""
| _chat_focused_line | Ligne à la position (x,y) _(WeeChat ≥ 4.0.0)_.
| _chat_focused_line | Ligne à la position (x, y) _(WeeChat ≥ 4.0.0)_.
| "Hello world!" | ""
| _chat_focused_line_bol | Texte du début de la ligne jusqu'à (x-1, y) _(WeeChat ≥ 4.1.0)_.
| "Hello" | ""
| _chat_focused_line_eol | Texte de (x, y) jusqu'à la fin de la ligne _(WeeChat ≥ 4.1.0)_.
| "llo world!" | ""
| _chat_word | Mot à la position (x,y).
| "Hello" | ""
| _chat_bol | Texte du début de ligne jusqu'à (x-1, y).
| _chat_bol | Texte du début du message jusqu'à (x-1, y).
| "He" | ""
| _chat_eol | Texte de (x, y) jusqu'à la fin de la ligne.
| _chat_eol | Texte de (x, y) jusqu'à la fin du message.
| "llo world!" | ""
| _bar_name | Nom de la barre.
+12 -4
View File
@@ -13486,7 +13486,7 @@ Questa funzione non è disponibile nelle API per lo scripting.
==== hook_focus
// TRANSLATION MISSING
_Updated in 1.5._
_Updated in 1.5, 4.0.0, 4.1.0._
Hook sul foucus: evento del mouse o tasto premuto nella modalità cursore
(movimento libero del cursore).
@@ -13606,18 +13606,26 @@ Contenuto della tabella hash inviata alla callback (tasti e valori sono di tipo
| "Hello world!" | ""
// TRANSLATION MISSING
| _chat_focused_line | Line at (x,y) _(WeeChat ≥ 4.0.0)_.
| _chat_focused_line | Line at (x, y) _(WeeChat ≥ 4.0.0)_.
| "Hello world!" | ""
// TRANSLATION MISSING
| _chat_focused_line_bol | Text from beginning of line to (x-1, y) _(WeeChat ≥ 4.1.0)_.
| "Hello" | ""
// TRANSLATION MISSING
| _chat_focused_line_eol | Text from (x, y) to end of line _(WeeChat ≥ 4.1.0)_.
| "llo world!" | ""
| _chat_word | Parola a (x,y).
| "Hello" | ""
// TRANSLATION MISSING
| _chat_bol | Text from beginning of line to (x-1, y).
| _chat_bol | Text from beginning of message to (x-1, y).
| "He" | ""
// TRANSLATION MISSING
| _chat_eol | Text from (x, y) to the end of line.
| _chat_eol | Text from (x, y) to the end of message.
| "llo world!" | ""
| _bar_name | Nome della barra.
+12 -4
View File
@@ -13051,7 +13051,7 @@ struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
==== hook_focus
_WeeChat バージョン 1.5 で更新。_
_WeeChat バージョン 1.5, 4.0.0, 4.1.0 で更新。_
フォーカス (マウスイベントやカーソルモード
(カーソルが自由に移動出来る状態) でキーが押されたこと) をフック。
@@ -13168,18 +13168,26 @@ info を使う前にエリアが一致していることを確認して下さい
| "Hello world!" | ""
// TRANSLATION MISSING
| _chat_focused_line | Line at (x,y) _(WeeChat ≥ 4.0.0)_.
| _chat_focused_line | Line at (x, y) _(WeeChat ≥ 4.0.0)_.
| "Hello world!" | ""
// TRANSLATION MISSING
| _chat_focused_line_bol | Text from beginning of line to (x-1, y) _(WeeChat ≥ 4.1.0)_.
| "Hello" | ""
// TRANSLATION MISSING
| _chat_focused_line_eol | Text from (x, y) to end of line _(WeeChat ≥ 4.1.0)_.
| "llo world!" | ""
| _chat_word | (x,y) の位置にある単語
| "Hello" | ""
// TRANSLATION MISSING
| _chat_bol | Text from beginning of line to (x-1, y).
| _chat_bol | Text from beginning of message to (x-1, y).
| "He" | ""
// TRANSLATION MISSING
| _chat_eol | Text from (x, y) to the end of line.
| _chat_eol | Text from (x, y) to the end of message.
| "llo world!" | ""
| _bar_name | バーの名前
+14 -4
View File
@@ -12482,7 +12482,7 @@ struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
==== hook_focus
_Ажурирано у верзији 1.5._
_Ажурирано у верзији 1.5, 4.0.0, 4.1.0._
Качи се на фокус: догађај миша или тастер притиснут у режиму померања курсора.
@@ -12584,16 +12584,26 @@ struct t_hook *weechat_hook_focus (const char *area,
| _chat_line_message | Порука линије.
| "Hello world!" | ""
| _chat_focused_line | Линија на (x,y) _(WeeChat ≥ 4.0.0)_.
| _chat_focused_line | Линија на (x, y) _(WeeChat ≥ 4.0.0)_.
| "Здраво свима!" | ""
// TRANSLATION MISSING
| _chat_focused_line_bol | Text from beginning of line to (x-1, y) _(WeeChat ≥ 4.1.0)_.
| "Hello" | ""
// TRANSLATION MISSING
| _chat_focused_line_eol | Text from (x, y) to end of line _(WeeChat ≥ 4.1.0)_.
| "llo world!" | ""
| _chat_word | Реч на (x,y).
| "Здраво" | ""
| _chat_bol | Текст од почетка линије до (x-1, y).
// TRANSLATION MISSING
| _chat_bol | Text from beginning of message to (x-1, y).
| "Зд" | ""
| _chat_eol | Тест од (x, y) до краја линије.
// TRANSLATION MISSING
| _chat_eol | Text from (x, y) to the end of message.
| "раво свете!" | ""
| _bar_name | Име траке.
+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);