From dfdd5b1c5075c689ee20b857c46327f8add848b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 26 May 2021 08:53:31 +0200 Subject: [PATCH] core: add signals "cursor_start" and "cursor_end" --- ChangeLog.adoc | 1 + doc/en/weechat_plugin_api.en.adoc | 12 ++++++++++++ doc/fr/weechat_plugin_api.fr.adoc | 12 ++++++++++++ doc/it/weechat_plugin_api.it.adoc | 14 ++++++++++++++ doc/ja/weechat_plugin_api.ja.adoc | 14 ++++++++++++++ src/gui/gui-cursor.c | 7 +++++++ 6 files changed, 60 insertions(+) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 3258ac45b..46793aeac 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -25,6 +25,7 @@ New features:: * core: evaluate option weechat.plugin.path, change default value to "${weechat_data_dir}/plugins" * core: add options to customize commands executed on system signals received (SIGHUP, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2) (issue #1595) * core: quit WeeChat by default when signal SIGHUP is received in normal run, reload configuration in weechat-headless (issue #1595) + * core: add signals "cursor_start" and "cursor_end" * api: add translated string in evaluation of expressions with "translate:xxx" * api: add evaluation of WeeChat directories with "${weechat_xxx_dir}" in evaluated strings * api: add optional key "directory" in hashtable options of function/modifier string_eval_path_home diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 261b01001..604c00b32 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -10553,6 +10553,18 @@ List of signals sent by WeeChat and plugins: Pointer: buffer. | Merged buffer unzoomed. +| weechat | + [[hook_signal_cursor_start]] cursor_start + + _(WeeChat ≥ 3.2)_ | + - | + Start cursor mode. + +| weechat | + [[hook_signal_cursor_end]] cursor_end + + _(WeeChat ≥ 3.2)_ | + - | + End cursor mode. + | weechat | [[hook_signal_day_changed]] day_changed + _(WeeChat ≥ 0.3.2)_ | diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index f2d431736..65cc46414 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -10761,6 +10761,18 @@ Liste des signaux envoyés par WeeChat et les extensions : Pointeur : tampon. | Fin du zoom sur un tampon mélangé. +| weechat | + [[hook_signal_cursor_start]] cursor_start + + _(WeeChat ≥ 3.2)_ | + - | + Début du mode curseur. + +| weechat | + [[hook_signal_cursor_end]] cursor_end + + _(WeeChat ≥ 3.2)_ | + - | + Fin du mode curseur. + | weechat | [[hook_signal_day_changed]] day_changed + _(WeeChat ≥ 0.3.2)_ | diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 9b8bd06bd..1d266f083 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -10932,6 +10932,20 @@ List of signals sent by WeeChat and plugins: Puntatore: buffer. | Merged buffer unzoomed. +// TRANSLATION MISSING +| weechat | + [[hook_signal_cursor_start]] cursor_start + + _(WeeChat ≥ 3.2)_ | + - | + Start cursor mode. + +// TRANSLATION MISSING +| weechat | + [[hook_signal_cursor_end]] cursor_end + + _(WeeChat ≥ 3.2)_ | + - | + End cursor mode. + | weechat | [[hook_signal_day_changed]] day_changed + _(WeeChat ≥ 0.3.2)_ | diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index 21fe38997..b88949e48 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -10563,6 +10563,20 @@ WeeChat とプラグインが送信するシグナルのリスト: Pointer: バッファ | マージされたバッファをアンズーム +// TRANSLATION MISSING +| weechat | + [[hook_signal_cursor_start]] cursor_start + + _(WeeChat ≥ 3.2)_ | + - | + Start cursor mode. + +// TRANSLATION MISSING +| weechat | + [[hook_signal_cursor_end]] cursor_end + + _(WeeChat ≥ 3.2)_ | + - | + End cursor mode. + | weechat | [[hook_signal_day_changed]] day_changed + _(WeeChat バージョン 0.3.2 以上で利用可)_ | diff --git a/src/gui/gui-cursor.c b/src/gui/gui-cursor.c index fb42e6f98..bd0c46c4e 100644 --- a/src/gui/gui-cursor.c +++ b/src/gui/gui-cursor.c @@ -28,6 +28,8 @@ #include #include "../core/weechat.h" +#include "../core/wee-hook.h" +#include "../plugins/plugin.h" #include "gui-cursor.h" #include "gui-bar.h" #include "gui-bar-window.h" @@ -72,6 +74,11 @@ gui_cursor_mode_toggle () 1); /* stop completion */ gui_buffer_ask_chat_refresh (gui_current_window->buffer, 2); } + + (void) hook_signal_send ( + (gui_cursor_mode) ? "cursor_start" : "cursor_stop", + WEECHAT_HOOK_SIGNAL_STRING, + NULL); } /*