From 7389514c0977f3c85faf0cd52db5b9e9759cc5f6 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 15 Jul 2013 19:04:00 +0200 Subject: core: add option weechat.look.key_bind_safe --- src/core/wee-command.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/core/wee-command.c') diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 133646047..3daf55edc 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -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]); -- cgit v1.2.3