core: add option weechat.look.key_bind_safe

This commit is contained in:
Sebastien Helleu 2013-07-15 19:04:00 +02:00
parent 92609e3cd6
commit 7389514c09
23 changed files with 246 additions and 14 deletions

View File

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.2-dev, 2013-07-13
v0.4.2-dev, 2013-07-15
This document lists all changes for each version.
@ -14,6 +14,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
Version 0.4.2 (under dev!)
--------------------------
* core: add option weechat.look.key_bind_safe
* core: fix char displayed at the intersection of three windows (bug #39331)
* core: fix crash in evaluation of expression when reading a string in hdata
with a NULL value (bug #39419)

View File

@ -593,6 +593,11 @@
** Typ: boolesch
** Werte: on, off (Standardwert: `on`)
* [[option_weechat.look.key_bind_safe]] *weechat.look.key_bind_safe*
** Beschreibung: `allow only binding of "safe" keys (beginning with a ctrl or meta code)`
** Typ: boolesch
** Werte: on, off (Standardwert: `on`)
* [[option_weechat.look.mouse]] *weechat.look.mouse*
** Beschreibung: `Mausunterstützung einschalten`
** Typ: boolesch

View File

@ -593,6 +593,11 @@
** type: boolean
** values: on, off (default value: `on`)
* [[option_weechat.look.key_bind_safe]] *weechat.look.key_bind_safe*
** description: `allow only binding of "safe" keys (beginning with a ctrl or meta code)`
** type: boolean
** values: on, off (default value: `on`)
* [[option_weechat.look.mouse]] *weechat.look.mouse*
** description: `enable mouse support`
** type: boolean

View File

@ -593,6 +593,11 @@
** type: booléen
** valeurs: on, off (valeur par défaut: `on`)
* [[option_weechat.look.key_bind_safe]] *weechat.look.key_bind_safe*
** description: `autoriser seulement l'association de touches "sûres" (commençant par un code ctrl ou meta)`
** type: booléen
** valeurs: on, off (valeur par défaut: `on`)
* [[option_weechat.look.mouse]] *weechat.look.mouse*
** description: `activer le support de la souris`
** type: booléen

View File

@ -593,6 +593,11 @@
** tipo: bool
** valori: on, off (valore predefinito: `on`)
* [[option_weechat.look.key_bind_safe]] *weechat.look.key_bind_safe*
** descrizione: `allow only binding of "safe" keys (beginning with a ctrl or meta code)`
** tipo: bool
** valori: on, off (valore predefinito: `on`)
* [[option_weechat.look.mouse]] *weechat.look.mouse*
** descrizione: `abilita il supporto del mouse`
** tipo: bool

View File

@ -593,6 +593,11 @@
** タイプ: ブール
** 値: on, off (デフォルト値: `on`)
* [[option_weechat.look.key_bind_safe]] *weechat.look.key_bind_safe*
** 説明: `allow only binding of "safe" keys (beginning with a ctrl or meta code)`
** タイプ: ブール
** 値: on, off (デフォルト値: `on`)
* [[option_weechat.look.mouse]] *weechat.look.mouse*
** 説明: `マウスサポートの有効化`
** タイプ: ブール

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-06-10 09:13+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -431,6 +431,13 @@ msgstr "Klávesa:"
msgid "No key found"
msgstr "Žádná klávesa nenalezena"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, fuzzy, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%sChyba: filtr \"%s\" nenalezen"
@ -2674,6 +2681,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr ""
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
#, fuzzy
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr "text pro zobrazení před přezdívkou v okně rozhovoru"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-07-02 22:20+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@ -445,6 +445,13 @@ msgstr "Taste:"
msgid "No key found"
msgstr "Keine Taste gefunden"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%sFehler: Kontext\"%s\" nicht gefunden"
@ -3009,6 +3016,10 @@ msgstr ""
"springt zurück zum Ausgangsbuffer, falls keine weiteren Einträge in der "
"Hotlist vorhanden sind"
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr "Text, der vor dem Nick dargestellt werden soll, Beispiel: \"<\""

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-07-02 15:57+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -440,6 +440,13 @@ msgstr "Tecla:"
msgid "No key found"
msgstr "Ninguna tecla encontrada"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%sError: contexto \"%s\" no encontrado"
@ -2831,6 +2838,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr ""
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
#, fuzzy
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr "texto a mostrar antes del apodo en la ventana de charla"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"PO-Revision-Date: 2013-07-11 20:02+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-07-15 18:35+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -437,6 +437,17 @@ msgstr "Touche:"
msgid "No key found"
msgstr "Aucune touche trouvée"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
"%sErreur: il n'est pas sûr d'associer la touche \"%s\" car elle ne commence "
"pas par un code ctrl ou meta (astuce: utilisez alt-k pour trouver le code "
"d'une touche); si vous voulez quand même associer cette touche, désactivez "
"l'option weechat.look.key_bind_safe"
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%sErreur: contexte \"%s\" non trouvé"
@ -2920,6 +2931,12 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr "retourner au tampon initial après avoir atteint la fin de la hotlist"
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
"autoriser seulement l'association de touches \"sûres\" (commençant par un "
"code ctrl ou meta)"
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr "texte à afficher avant le pseudo dans le préfixe, par exemple: \"<\""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-07-02 15:57+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -447,6 +447,13 @@ msgstr "Billentyű:\n"
msgid "No key found"
msgstr "Nem találtam billentyűt.\n"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, fuzzy, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%s a \"%s\" modul nem található\n"
@ -2297,6 +2304,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr ""
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
#, fuzzy
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr "a név előtt megjelenítendő szöveg a beszédablakban"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-06-14 19:39-0300\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -436,6 +436,13 @@ msgstr "Tasto:"
msgid "No key found"
msgstr "Nessun tasto trovato"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%sErrore: contesto \"%s\" non trovato"
@ -2877,6 +2884,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr "torna al buffer iniziale dopo aver raggiunto la fine della hotlist"
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr ""
"testo da visualizzare prima del nick nel prefisso del messaggio, esempio: \"<"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-07-02 16:02+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@ -437,6 +437,13 @@ msgstr "キー:"
msgid "No key found"
msgstr "キーがありません"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%sエラー: コンテキスト \"%s\" が見つかりません"
@ -2836,6 +2843,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr "ホットリストの最後に到達したら最初のバッファに移動する"
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr ""
"メッセージプレフィックス中のニックネームの前に表示するテキスト、例: \"<\""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-07-02 15:37+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -441,6 +441,13 @@ msgstr "Klawisz:"
msgid "No key found"
msgstr "Nie znaleziono klawisza"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%sBłąd: nie odnaleziono kontekstu \"%s\""
@ -2900,6 +2907,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr "wróć do początkowego buforu po dotarciu na koniec hotlisty"
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr "teks wyświetlany przed nickiem w prefiksie wiadomości, przykład: \"<\""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-06-10 09:19+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -467,6 +467,13 @@ msgstr "Tecla:"
msgid "No key found"
msgstr "Nenhuma tecla encontrada"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%sErro: contexto \"%s\" não encontrado"
@ -2752,6 +2759,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr ""
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
#, fuzzy
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr "texto a ser exibido antes do apelido na janela de chat"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-07-02 16:02+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -456,6 +456,13 @@ msgstr "Клавиша:\n"
msgid "No key found"
msgstr "Клавиши не найдены.\n"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, fuzzy, c-format
msgid "%sError: context \"%s\" not found"
msgstr "%s plugin \"%s\" не найден\n"
@ -2327,6 +2334,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr ""
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
#, fuzzy
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr "текст, который отображать до ника в окне чата"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-06-28 13:51+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -405,6 +405,13 @@ msgstr "Tuş:"
msgid "No key found"
msgstr "Tuş bulunamadı"
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr ""
@ -2050,6 +2057,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr ""
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2013-07-11 21:45+0200\n"
"POT-Creation-Date: 2013-07-15 18:33+0200\n"
"PO-Revision-Date: 2013-02-14 18:20+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -405,6 +405,13 @@ msgstr ""
msgid "No key found"
msgstr ""
#, c-format
msgid ""
"%sError: it is not safe to bind key \"%s\" because it does not start with a "
"ctrl or meta code (tip: use alt-k to find key codes); if you want to bind "
"this key anyway, turn off option weechat.look.key_bind_safe"
msgstr ""
#, c-format
msgid "%sError: context \"%s\" not found"
msgstr ""
@ -2057,6 +2064,10 @@ msgstr ""
msgid "jump back to initial buffer after reaching end of hotlist"
msgstr ""
msgid ""
"allow only binding of \"safe\" keys (beginning with a ctrl or meta code)"
msgstr ""
msgid "text to display before nick in prefix of message, example: \"<\""
msgstr ""

View File

@ -2876,6 +2876,19 @@ COMMAND_CALLBACK(key)
}
/* bind new key */
if (CONFIG_BOOLEAN(config_look_key_bind_safe)
&& !gui_key_is_safe (GUI_KEY_CONTEXT_DEFAULT, argv[2]))
{
gui_chat_printf (NULL,
_("%sError: it is not safe to bind key \"%s\" because "
"it does not start with a ctrl or meta code (tip: "
"use alt-k to find key codes); if you want to "
"bind this key anyway, turn off option "
"weechat.look.key_bind_safe"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[2]);
return WEECHAT_RC_OK;
}
gui_key_verbose = 1;
ptr_new_key = gui_key_bind (NULL, GUI_KEY_CONTEXT_DEFAULT,
argv[2], argv_eol[3]);
@ -2932,6 +2945,19 @@ COMMAND_CALLBACK(key)
}
/* bind new key */
if (CONFIG_BOOLEAN(config_look_key_bind_safe)
&& !gui_key_is_safe (GUI_KEY_CONTEXT_DEFAULT, argv[3]))
{
gui_chat_printf (NULL,
_("%sError: it is not safe to bind key \"%s\" because "
"it does not start with a ctrl or meta code (tip: "
"use alt-k to find key codes); if you want to "
"bind this key anyway, turn off option "
"weechat.look.key_bind_safe"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[3]);
return WEECHAT_RC_OK;
}
gui_key_verbose = 1;
ptr_new_key = gui_key_bind (NULL, context,
argv[3], argv_eol[4]);

View File

@ -124,6 +124,7 @@ struct t_config_option *config_look_item_buffer_filter;
struct t_config_option *config_look_jump_current_to_previous_buffer;
struct t_config_option *config_look_jump_previous_buffer_when_closing;
struct t_config_option *config_look_jump_smart_back_to_buffer;
struct t_config_option *config_look_key_bind_safe;
struct t_config_option *config_look_nick_prefix;
struct t_config_option *config_look_nick_suffix;
struct t_config_option *config_look_mouse;
@ -2203,6 +2204,12 @@ config_weechat_init_options ()
"jump_smart_back_to_buffer", "boolean",
N_("jump back to initial buffer after reaching end of hotlist"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_key_bind_safe = config_file_new_option (
weechat_config_file, ptr_section,
"key_bind_safe", "boolean",
N_("allow only binding of \"safe\" keys (beginning with a ctrl or meta "
"code)"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_nick_prefix = config_file_new_option (
weechat_config_file, ptr_section,
"nick_prefix", "string",

View File

@ -149,6 +149,7 @@ extern struct t_config_option *config_look_item_buffer_filter;
extern struct t_config_option *config_look_jump_current_to_previous_buffer;
extern struct t_config_option *config_look_jump_previous_buffer_when_closing;
extern struct t_config_option *config_look_jump_smart_back_to_buffer;
extern struct t_config_option *config_look_key_bind_safe;
extern struct t_config_option *config_look_nick_prefix;
extern struct t_config_option *config_look_nick_suffix;
extern struct t_config_option *config_look_mouse;

View File

@ -580,6 +580,39 @@ gui_key_set_score (struct t_gui_key *key)
key->score = score;
}
/*
* Checks if a key is safe or not: a safe key begins always with the "meta" or
* "ctrl" code (except "@" allowed in cursor/mouse contexts).
*
* Returns:
* 1: key is safe
* 0: key is NOT safe
*/
int
gui_key_is_safe (int context, const char *key)
{
char *internal_code;
int rc;
/* "@" is allowed at beginning for cursor/mouse contexts */
if ((key[0] == '@')
&& ((context == GUI_KEY_CONTEXT_CURSOR)
|| (context == GUI_KEY_CONTEXT_MOUSE)))
{
return 1;
}
/* check that first char is a ctrl or meta code */
internal_code = gui_key_get_internal_code (key);
if (!internal_code)
return 0;
rc = (internal_code[0] == '\x01') ? 1 : 0;
free (internal_code);
return rc;
}
/*
* Adds a new key in keys list.
*

View File

@ -90,6 +90,7 @@ extern int gui_key_search_context (const char *context);
extern void gui_key_grab_init (int grab_command, const char *delay);
extern char *gui_key_get_internal_code (const char *key);
extern char *gui_key_get_expanded_name (const char *key);
extern int gui_key_is_safe (int context, const char *key);
extern struct t_gui_key *gui_key_new (struct t_gui_buffer *buffer,
int context,
const char *key,