mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
core: add signals "key_combo_{default|search|cursor}"
This commit is contained in:
@@ -11,6 +11,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
|
||||
== Version 0.4.4 (under dev!)
|
||||
|
||||
* core: add signals "key_combo_{default|search|cursor}"
|
||||
* core: display a warning in case of inconsistency between the options
|
||||
weechat.look.save_{config|layout}_on_exit
|
||||
* api: add integer return code for functions hook_{signal|hsignal}_send
|
||||
|
||||
@@ -7854,6 +7854,21 @@ List of signals sent by WeeChat and plugins:
|
||||
String: key pressed |
|
||||
Key pressed
|
||||
|
||||
| weechat | key_combo_default +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'default' context
|
||||
|
||||
| weechat | key_combo_search +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'search' context
|
||||
|
||||
| weechat | key_combo_cursor +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'cursor' context
|
||||
|
||||
| weechat | nicklist_group_added +
|
||||
_(WeeChat ≥ 0.3.2)_ |
|
||||
String: buffer pointer + "," + group name |
|
||||
|
||||
@@ -7984,6 +7984,21 @@ Liste des signaux envoyés par WeeChat et les extensions :
|
||||
Chaîne : touche appuyée |
|
||||
Touche appuyée
|
||||
|
||||
| weechat | key_combo_default +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
Chaîne : combinaison de touches |
|
||||
Combinaison de touches dans le contexte 'default'
|
||||
|
||||
| weechat | key_combo_search +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
Chaîne : combinaison de touches |
|
||||
Combinaison de touches dans le contexte 'search'
|
||||
|
||||
| weechat | key_combo_cursor +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
Chaîne : combinaison de touches |
|
||||
Combinaison de touches dans le contexte 'cursor'
|
||||
|
||||
| weechat | nicklist_group_added +
|
||||
_(WeeChat ≥ 0.3.2)_ |
|
||||
Chaîne : pointeur tampon + "," + nom du groupe |
|
||||
|
||||
@@ -8009,6 +8009,24 @@ List of signals sent by WeeChat and plugins:
|
||||
String: tasto digitato |
|
||||
Tasto digitato
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | key_combo_default +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'default' context
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | key_combo_search +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'search' context
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | key_combo_cursor +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'cursor' context
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | nicklist_group_added +
|
||||
_(WeeChat ≥ 0.3.2)_ |
|
||||
|
||||
@@ -7849,6 +7849,24 @@ WeeChat とプラグインが送信するシグナルのリスト:
|
||||
String: 押されたキー |
|
||||
キーが押された
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | key_combo_default +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'default' context
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | key_combo_search +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'search' context
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| weechat | key_combo_cursor +
|
||||
_(WeeChat ≥ 0.4.4)_ |
|
||||
String: key combo |
|
||||
Key combo in 'cursor' context
|
||||
|
||||
| weechat | nicklist_group_added +
|
||||
_(WeeChat バージョン 0.3.2 以上で利用可)_ |
|
||||
String: バッファポインタ + "," + グループ名 |
|
||||
|
||||
+34
-3
@@ -1246,9 +1246,11 @@ end:
|
||||
int
|
||||
gui_key_pressed (const char *key_str)
|
||||
{
|
||||
int i, first_key, context, length, length_key;
|
||||
int i, first_key, context, length, length_key, rc, signal_sent;
|
||||
struct t_gui_key *ptr_key;
|
||||
char *pos;
|
||||
char *pos, signal_name[128];
|
||||
|
||||
signal_sent = 0;
|
||||
|
||||
/* add key to buffer */
|
||||
first_key = (gui_key_combo_buffer[0] == '\0');
|
||||
@@ -1329,8 +1331,14 @@ gui_key_pressed (const char *key_str)
|
||||
if (strcmp (ptr_key->key, gui_key_combo_buffer) == 0)
|
||||
{
|
||||
/* exact combo found => execute command */
|
||||
signal_sent = 1;
|
||||
snprintf (signal_name, sizeof (signal_name),
|
||||
"key_combo_%s", gui_key_context_string[context]);
|
||||
rc = hook_signal_send (signal_name,
|
||||
WEECHAT_HOOK_SIGNAL_STRING,
|
||||
gui_key_combo_buffer);
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
if (ptr_key->commands)
|
||||
if ((rc != WEECHAT_RC_OK_EAT) && ptr_key->commands)
|
||||
{
|
||||
for (i = 0; ptr_key->commands[i]; i++)
|
||||
{
|
||||
@@ -1343,6 +1351,16 @@ gui_key_pressed (const char *key_str)
|
||||
}
|
||||
else if (context == GUI_KEY_CONTEXT_CURSOR)
|
||||
{
|
||||
signal_sent = 1;
|
||||
snprintf (signal_name, sizeof (signal_name),
|
||||
"key_combo_%s", gui_key_context_string[context]);
|
||||
if (hook_signal_send (signal_name,
|
||||
WEECHAT_HOOK_SIGNAL_STRING,
|
||||
gui_key_combo_buffer) == WEECHAT_RC_OK_EAT)
|
||||
{
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
if (gui_key_focus (gui_key_combo_buffer, GUI_KEY_CONTEXT_CURSOR))
|
||||
{
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
@@ -1350,6 +1368,19 @@ gui_key_pressed (const char *key_str)
|
||||
}
|
||||
}
|
||||
|
||||
if (!signal_sent && first_key)
|
||||
{
|
||||
snprintf (signal_name, sizeof (signal_name),
|
||||
"key_combo_%s", gui_key_context_string[context]);
|
||||
if (hook_signal_send (signal_name,
|
||||
WEECHAT_HOOK_SIGNAL_STRING,
|
||||
gui_key_combo_buffer) == WEECHAT_RC_OK_EAT)
|
||||
{
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user