diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-03-11 15:24:40 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-03-16 20:42:19 +0100 |
commit | bb0c7b39feef2046a8f8caa6476874ea74e27089 (patch) | |
tree | b87e5dc3b910ca633202bb7713fd1f1b17c9225b | |
parent | a0c3fbbde9dd159aa6be752246924621c9c77bc5 (diff) | |
download | weechat-bb0c7b39feef2046a8f8caa6476874ea74e27089.zip |
api: change also default value of new key options with function key_bind
-rw-r--r-- | src/gui/gui-key.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index eb6bc4ac9..fccb7b428 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -1547,26 +1547,22 @@ gui_key_bind_plugin_hashtable_map_cb (void *data, return; ptr_key = gui_key_search (gui_keys[user_data[0]], key); - if (ptr_key) + if (!ptr_key) { - /* - * adjust default value (command) of key option in config, so that - * fset buffer shows the key as modified only if the user actually - * changed the command bound to the key - */ - ptr_option = config_file_search_option ( - weechat_config_file, - weechat_config_section_key[user_data[0]], - key); - if (ptr_option) - config_file_option_set_default (ptr_option, value, 1); - } - else - { - /* create key */ if (gui_key_new (NULL, user_data[0], key, value, 1)) user_data[1]++; } + /* + * adjust default value (command) of key option in config, so that + * fset buffer shows the key as modified only if the user actually + * changed the command bound to the key + */ + ptr_option = config_file_search_option ( + weechat_config_file, + weechat_config_section_key[user_data[0]], + key); + if (ptr_option) + config_file_option_set_default (ptr_option, value, 1); } } |