From c9460565b8d88c122539c2fa47e09239b0d23cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 13 Jun 2017 21:17:35 +0200 Subject: [PATCH] fset: add key alt-p on fset buffer, rename option fset.look.show_plugin_description to fset.look.show_plugins_desc --- src/plugins/fset/fset-buffer.c | 45 ++++++++++++++++++--------------- src/plugins/fset/fset-command.c | 9 ------- src/plugins/fset/fset-config.c | 15 ++++++----- src/plugins/fset/fset-config.h | 2 +- src/plugins/fset/fset-option.c | 2 +- 5 files changed, 34 insertions(+), 39 deletions(-) diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c index ccf505b08..e0c216d35 100644 --- a/src/plugins/fset/fset-buffer.c +++ b/src/plugins/fset/fset-buffer.c @@ -932,26 +932,29 @@ fset_buffer_set_callbacks () void fset_buffer_set_keys () { - char *keys[][2] = { { "meta2-A", "up" }, - { "meta2-B", "down" }, - { "meta-meta2-1~", "go 0" }, - { "meta-meta2-4~", "go end" }, - { "meta2-23~", "left" }, - { "meta2-24~", "right" }, - { "meta- ", "toggle" }, - { "meta--", "add -1" }, - { "meta-+", "add 1" }, - { "meta-fmeta-r", "reset" }, - { "meta-fmeta-u", "unset" }, - { "meta-ctrl-J", "set" }, - { "meta-ctrl-M", "set" }, - { "meta-fmeta-a", "append" }, - { "meta-,", "mark 1" }, - { "meta2-a", "mark -1" }, - { "meta2-b", "mark 1" }, - { "meta-v", "toggle_bar" }, - { "ctrl-L", "refresh" }, - { NULL, NULL } }; + char *keys[][2] = { + { "meta2-A", "/fset -up" }, + { "meta2-B", "/fset -down" }, + { "meta-meta2-1~", "/fset -go 0" }, + { "meta-meta2-4~", "/fset -go end" }, + { "meta2-23~", "/fset -left" }, + { "meta2-24~", "/fset -right" }, + { "meta- ", "/fset -toggle" }, + { "meta--", "/fset -add -1" }, + { "meta-+", "/fset -add 1" }, + { "meta-fmeta-r", "/fset -reset" }, + { "meta-fmeta-u", "/fset -unset" }, + { "meta-ctrl-J", "/fset -set" }, + { "meta-ctrl-M", "/fset -set" }, + { "meta-fmeta-a", "/fset -append" }, + { "meta-,", "/fset -mark 1" }, + { "meta2-a", "/fset -mark -1" }, + { "meta2-b", "/fset -mark 1" }, + { "ctrl-L", "/fset -refresh" }, + { "meta-p", "/mute /set fset.look.show_plugins_desc toggle", }, + { "meta-v", "/mute /set fset.look.show_help_bar toggle" }, + { NULL, NULL }, + }; char str_key[64], str_command[64]; int i; @@ -960,7 +963,7 @@ fset_buffer_set_keys () if (weechat_config_boolean (fset_config_look_use_keys)) { snprintf (str_key, sizeof (str_key), "key_bind_%s", keys[i][0]); - snprintf (str_command, sizeof (str_command), "/fset -%s", keys[i][1]); + snprintf (str_command, sizeof (str_command), "%s", keys[i][1]); weechat_buffer_set (fset_buffer, str_key, str_command); } else diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c index 90670111a..b359ec548 100644 --- a/src/plugins/fset/fset-command.c +++ b/src/plugins/fset/fset-command.c @@ -114,12 +114,6 @@ fset_command_fset (const void *pointer, void *data, return WEECHAT_RC_OK; } - if (weechat_strcasecmp (argv[1], "-toggle_bar") == 0) - { - weechat_config_option_set (fset_config_look_show_help_bar, "toggle", 1); - return WEECHAT_RC_OK; - } - if (weechat_strcasecmp (argv[1], "-refresh") == 0) { fset_option_get_options (); @@ -519,7 +513,6 @@ fset_command_init () "fset", N_("fast set WeeChat and plugins options"), N_("-bar" - " || -toggle_bar" " || -refresh" " || -up|-down []" " || -left|-right []" @@ -533,7 +526,6 @@ fset_command_init () " || -mark []" " || filter"), N_(" -bar: add the help bar\n" - "-toggle_bar: toggle the help bar\n" " -refresh: refresh list of options, then whole screen " "(command: /window refresh)\n" " -up: move the selected line up by \"number\" lines\n" @@ -673,7 +665,6 @@ fset_command_init () " show all integer options in irc plugin:\n" " /fset c:${file} == irc && ${type} == int"), "-bar" - " || -toggle_bar" " || -refresh" " || -up 1|2|3|4|5" " || -down 1|2|3|4|5" diff --git a/src/plugins/fset/fset-config.c b/src/plugins/fset/fset-config.c index f295438cf..f1781e977 100644 --- a/src/plugins/fset/fset-config.c +++ b/src/plugins/fset/fset-config.c @@ -39,7 +39,7 @@ struct t_config_option *fset_config_look_condition_catch_set; struct t_config_option *fset_config_look_marked_string; struct t_config_option *fset_config_look_scroll_horizontal; struct t_config_option *fset_config_look_show_help_bar; -struct t_config_option *fset_config_look_show_plugin_description; +struct t_config_option *fset_config_look_show_plugins_desc; struct t_config_option *fset_config_look_sort; struct t_config_option *fset_config_look_unmarked_string; struct t_config_option *fset_config_look_use_color_value; @@ -109,12 +109,12 @@ fset_config_change_show_help_bar_cb (const void *pointer, void *data, } /* - * Callback for changes on option "fset.look.show_plugin_description". + * Callback for changes on option "fset.look.show_plugins_desc". */ void -fset_config_change_show_plugin_description_cb (const void *pointer, void *data, - struct t_config_option *option) +fset_config_change_show_plugins_desc_cb (const void *pointer, void *data, + struct t_config_option *option) { /* make C compiler happy */ (void) pointer; @@ -124,6 +124,7 @@ fset_config_change_show_plugin_description_cb (const void *pointer, void *data, if (fset_buffer) { fset_buffer_selected_line = 0; + fset_option_get_options (); fset_buffer_refresh (1); } } @@ -340,13 +341,13 @@ fset_config_init () NULL, NULL, NULL, &fset_config_change_show_help_bar_cb, NULL, NULL, NULL, NULL, NULL); - fset_config_look_show_plugin_description = weechat_config_new_option ( + fset_config_look_show_plugins_desc = weechat_config_new_option ( fset_config_file, ptr_section, - "show_plugin_description", "boolean", + "show_plugins_desc", "boolean", N_("show the plugin description options (plugins.desc.*)"), NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, - &fset_config_change_show_plugin_description_cb, NULL, NULL, + &fset_config_change_show_plugins_desc_cb, NULL, NULL, NULL, NULL, NULL); fset_config_look_sort = weechat_config_new_option ( fset_config_file, ptr_section, diff --git a/src/plugins/fset/fset-config.h b/src/plugins/fset/fset-config.h index ac8399a2a..2f76bf098 100644 --- a/src/plugins/fset/fset-config.h +++ b/src/plugins/fset/fset-config.h @@ -29,7 +29,7 @@ extern struct t_config_option *fset_config_look_condition_catch_set; extern struct t_config_option *fset_config_look_marked_string; extern struct t_config_option *fset_config_look_scroll_horizontal; extern struct t_config_option *fset_config_look_show_help_bar; -extern struct t_config_option *fset_config_look_show_plugin_description; +extern struct t_config_option *fset_config_look_show_plugins_desc; extern struct t_config_option *fset_config_look_sort; extern struct t_config_option *fset_config_look_unmarked_string; extern struct t_config_option *fset_config_look_use_color_value; diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index cb1b9ec6e..849b5983c 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -228,7 +228,7 @@ fset_option_match_filters (struct t_fset_option *fset_option) int match; char *result; - if (!weechat_config_boolean (fset_config_look_show_plugin_description) + if (!weechat_config_boolean (fset_config_look_show_plugins_desc) && (strcmp (fset_option->file, "plugins") == 0) && (strcmp (fset_option->section, "desc") == 0)) {