api: add support of prefix "quiet:" in function key_unbind() to quietly remove keys

v2.8-utf8proc
Sébastien Helleu 2017-10-24 23:03:40 +02:00
parent 759ccc328f
commit fe73a38b58
6 changed files with 30 additions and 14 deletions

View File

@ -34,6 +34,7 @@ Improvements::
* core: make value optional in command /buffer set (issue #746, issue #1088)
* core: allow floating point and hexadecimal numbers in comparison of evaluated values
* core: add option weechat.look.save_config_with_fsync (issue #1083)
* api: add support of prefix "quiet:" in function key_unbind() to quietly remove keys
* api: add argument "recurse_subdirs" in function exec_on_files()
* script: add local variable "filter" in the script buffer (issue #1037)

View File

@ -7343,7 +7343,7 @@ Arguments:
** _cursor_: free movement of cursor on screen
** _mouse_: keys for mouse events
* _keys_: hashtable with key bindings; it can contain following special keys:
** _{key_bind_quiet}_: do not display the keys added in core buffer
** _{key_bind_quiet}_: do not display the keys added in _core_ buffer
_(WeeChat ≥ 1.8)_
Return value:
@ -7385,7 +7385,7 @@ weechat.key_bind("mouse", keys)
==== key_unbind
_WeeChat ≥ 0.3.6._
_WeeChat ≥ 0.3.6, updated in 2.0._
Remove key binding(s).
@ -7403,7 +7403,8 @@ Arguments:
* _context_: context for keys (see <<_key_bind,key_bind>>)
* _key_: key to remove or a special value "area:XXX" to remove all keys having
_XXX_ as first or second area
_XXX_ as first or second area; if the key starts with "quiet:", the keys
removed are not displayed in _core_ buffer (_WeeChat ≥ 2.0_).
Return value:

View File

@ -7498,7 +7498,7 @@ weechat.key_bind("mouse", keys)
==== key_unbind
_WeeChat ≥ 0.3.6._
_WeeChat ≥ 0.3.6, mis à jour dans la 2.0._
Supprimer une/des association(s) de touche(s).
@ -7517,7 +7517,9 @@ Paramètres :
* _context_ : contexte pour les touches (voir <<_key_bind,key_bind>>)
* _key_ : touche à supprimer ou la valeur spéciale "area:XXX" pour supprimer
toutes les touches ayant _XXX_ comme première ou deuxième zone
toutes les touches ayant _XXX_ comme première ou deuxième zone; si la touche
commence par "quiet:", les touches supprimées ne sont pas affichées dans le
tampon _core_ (_WeeChat ≥ 2.0_).
Valeur de retour :

View File

@ -7569,7 +7569,7 @@ Argomenti:
** _mouse_: tasti per gli eventi del mouse
// TRANSLATION MISSING
* _keys_: hashtable with key bindings; it can contain following special keys:
** _{key_bind_quiet}_: do not display the keys added in core buffer
** _{key_bind_quiet}_: do not display the keys added in _core_ buffer
_(WeeChat ≥ 1.8)_
Valore restituito:
@ -7611,7 +7611,7 @@ weechat.key_bind("mouse", keys)
==== key_unbind
_WeeChat ≥ 0.3.6._
_WeeChat ≥ 0.3.6, updated in 2.0._
Rimuove una o più associazioni tasti.
@ -7629,8 +7629,10 @@ int weechat_key_unbind (const char *context, const char *key);
Argomenti:
* _context_: contesto per i tasti (consultare <<_key_bind,key_bind>>)
// TRANSLATION MISSING
* _key_: tasto da rimuovere o un valore speciale "area:XXX" per rimuovere tutti
i tasti che hanno _XXX_ come prima o seconda area
i tasti che hanno _XXX_ come prima o seconda area; if the key starts with
"quiet:", the keys removed are not displayed in _core_ buffer (_WeeChat ≥ 2.0_).
Valore restituito:

View File

@ -7396,7 +7396,7 @@ weechat.key_bind("mouse", keys)
==== key_unbind
_WeeChat バージョン 0.3.6 以上で利用可。_
_WeeChat バージョン 0.3.6 以上で利用可、バージョン 2.0 で更新。_
キー割り当てを削除。
@ -7413,8 +7413,11 @@ int weechat_key_unbind (const char *context, const char *key);
引数:
* _context_: キーのコンテキスト (<<_key_bind,key_bind>> を参照)
// TRANSLATION MISSING
* _key_: 削除するキーまたは特殊値 "area:XXX" で1 番目または 2
番目の領域から _XXX_ をもつすべてのキーを削除する
番目の領域から _XXX_ をもつすべてのキーを削除する;
if the key starts with "quiet:", the keys removed are not displayed in _core_
buffer (_WeeChat ≥ 2.0_).
戻り値:

View File

@ -927,6 +927,15 @@ gui_key_unbind_plugin (const char *context, const char *key)
if (ctxt < 0)
return 0;
if (strncmp (key, "quiet:", 6) == 0)
{
key += 6;
}
else
{
gui_key_verbose = 1;
}
if (strncmp (key, "area:", 5) == 0)
{
num_keys = 0;
@ -944,9 +953,7 @@ gui_key_unbind_plugin (const char *context, const char *key)
&& ptr_key->area_name[1]
&& (strcmp (ptr_key->area_name[1], area_name) == 0)))
{
gui_key_verbose = 1;
num_keys += gui_key_unbind (NULL, ctxt, ptr_key->key);
gui_key_verbose = 0;
}
}
free (area_name);
@ -954,11 +961,11 @@ gui_key_unbind_plugin (const char *context, const char *key)
}
else
{
gui_key_verbose = 1;
num_keys = gui_key_unbind (NULL, ctxt, key);
gui_key_verbose = 0;
}
gui_key_verbose = 0;
return num_keys;
}