diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index b48d66f08..7dd9e654a 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -8285,6 +8285,7 @@ Content of hashtable sent to callback (keys and values are of type "string"): | _buffer_plugin | plugin name of buffer | "core", "irc", ... | "" | _buffer_name | name of buffer | "weechat", "freenode.#weechat", ... | "" | _chat | chat area indicator | "0" or "1" | "0" +| _chat_line_x | column in line ^(2)^ | "0" ... "n" | "-1" | _chat_line_y | line number ^(2)^ | "0" ... "n" | "-1" | _chat_line_date | line date | "1313237175" | "0" | _chat_line_date_printed | line date ^(3)^ | "1313237175" | "0" @@ -8307,7 +8308,7 @@ Content of hashtable sent to callback (keys and values are of type "string"): ^(1)^ There are same keys suffixed with "2" (ie: "_x2", "_y2", "_window2", ...) with info on second point (useful only for mouse gestures, to know where mouse button has been released). + -^(2)^ Line number is set only for buffers with free content. + +^(2)^ It is set only for buffers with free content. + ^(3)^ It is date when WeeChat adds line in buffer (greater or equal to "chat_line_date"). diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index fa0c258d2..1e8d69403 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -8422,6 +8422,7 @@ Contenu de la hashtable envoyée au "callback" (les clés et valeurs sont de typ | _buffer_plugin | nom d'extension du tampon | "core", "irc", ... | "" | _buffer_name | nom du tampon | "weechat", "freenode.#weechat", ... | "" | _chat | indicateur zone "chat" | "0" ou "1" | "0" +| _chat_line_x | colonne de la ligne ^(2)^ | "0" ... "n" | "-1" | _chat_line_y | numéro de ligne ^(2)^ | "0" ... "n" | "-1" | _chat_line_date | date de la ligne | "1313237175" | "0" | _chat_line_date_printed | date de la ligne ^(3)^ | "1313237175" | "0" @@ -8445,8 +8446,7 @@ Contenu de la hashtable envoyée au "callback" (les clés et valeurs sont de typ "_window2", ...) avec l'information sur le second point (pratique seulement pour les gestes de souris, pour savoir où le bouton de la souris a été relâché). + -^(2)^ Le numéro de ligne n'est renseigné que pour les tampons avec contenu -libre. + +^(2)^ Renseigné seulement pour les tampons avec contenu libre. + ^(3)^ Il s'agit de la date lorsque WeeChat ajoute la ligne dans le tampon (supérieure ou égale à "chat_line_date"). diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index e1bddec96..8c3c82d4c 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -8342,6 +8342,7 @@ Content of hashtable sent to callback (keys and values are of type "string"): | _buffer_plugin | plugin name of buffer | "core", "irc", ... | "" | _buffer_name | name of buffer | "weechat", "freenode.#weechat", ... | "" | _chat | chat area indicator | "0" or "1" | "0" +| _chat_line_x | column in line ^(2)^ | "0" ... "n" | "-1" | _chat_line_y | line number ^(2)^ | "0" ... "n" | "-1" | _chat_line_date | line date | "1313237175" | "0" | _chat_line_date_printed | line date ^(3)^ | "1313237175" | "0" @@ -8364,7 +8365,7 @@ Content of hashtable sent to callback (keys and values are of type "string"): ^(1)^ There are same keys suffixed with "2" (ie: "_x2", "_y2", "_window2", ...) with info on second point (useful only for mouse gestures, to know where mouse button has been released). + -^(2)^ Line number is set only for buffers with free content. + +^(2)^ It is set only for buffers with free content. + ^(3)^ It is date when WeeChat adds line in buffer (greater or equal to "chat_line_date"). diff --git a/src/gui/gui-focus.c b/src/gui/gui-focus.c index 1debffd43..82d635b93 100644 --- a/src/gui/gui-focus.c +++ b/src/gui/gui-focus.c @@ -88,6 +88,7 @@ gui_focus_get_info (int x, int y) x, y, &focus_info->chat, &focus_info->chat_line, + &focus_info->chat_line_x, &focus_info->chat_word, &focus_info->chat_bol, &focus_info->chat_eol); @@ -176,6 +177,7 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key) str_tags = string_build_with_split_string ((const char **)((focus_info->chat_line)->data)->tags_array, ","); str_message = gui_color_decode (((focus_info->chat_line)->data)->message, NULL); nick = gui_line_get_nick_tag (focus_info->chat_line); + FOCUS_INT("_chat_line_x", focus_info->chat_line_x); FOCUS_INT("_chat_line_y", ((focus_info->chat_line)->data)->y); FOCUS_TIME("_chat_line_date", ((focus_info->chat_line)->data)->date); FOCUS_TIME("_chat_line_date_printed", ((focus_info->chat_line)->data)->date_printed); @@ -195,6 +197,7 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key) } else { + FOCUS_STR("_chat_line_x", "-1"); FOCUS_STR("_chat_line_y", "-1"); FOCUS_STR("_chat_line_date", "-1"); FOCUS_STR("_chat_line_date_printed", "-1"); diff --git a/src/gui/gui-focus.h b/src/gui/gui-focus.h index 471f24d26..eb1bb1851 100644 --- a/src/gui/gui-focus.h +++ b/src/gui/gui-focus.h @@ -28,6 +28,7 @@ struct t_gui_focus_info struct t_gui_window *window; /* window found */ int chat; /* 1 for chat area, otherwise 0 */ struct t_gui_line *chat_line; /* line in chat area */ + int chat_line_x; /* x in line */ char *chat_word; /* word at (x,y) */ char *chat_bol; /* beginnong of line until (x,y) */ char *chat_eol; /* (x,y) until end of line */ diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index bf0f2cde8..f16597d34 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -124,6 +124,7 @@ gui_window_search_by_xy (int x, int y) * gui_window_get_context_at_xy: return following info: * - chat (0/1) * - line + * - x in line * - word at (x,y) * - beginning of line until (x,y) * - (x,y) until end of line @@ -134,6 +135,7 @@ gui_window_get_context_at_xy (struct t_gui_window *window, int x, int y, int *chat, struct t_gui_line **line, + int *line_x, char **word, char **beginning, char **end) @@ -144,6 +146,7 @@ gui_window_get_context_at_xy (struct t_gui_window *window, *chat = 0; *line = NULL; + *line_x = -1; *word = NULL; *beginning = NULL; *end = NULL; @@ -167,6 +170,8 @@ gui_window_get_context_at_xy (struct t_gui_window *window, if (window->scroll->start_col > 0) win_x += window->scroll->start_col; + *line_x = win_x; + /* we are in chat area */ *chat = 1; diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h index c31cc05e4..73f817c08 100644 --- a/src/gui/gui-window.h +++ b/src/gui/gui-window.h @@ -141,6 +141,7 @@ extern void gui_window_get_context_at_xy (struct t_gui_window *window, int x, int y, int *chat, struct t_gui_line **line, + int *line_x, char **word, char **beginning, char **end);