fset: add alt-v and input "v" to toggle help bar, rename option fset.look.help_bar to fset.look.show_help_bar
This commit is contained in:
parent
bb5523d912
commit
feace6be0b
@ -41,7 +41,7 @@ struct t_gui_bar_item *fset_bar_item_fset = NULL;
|
|||||||
void
|
void
|
||||||
fset_bar_item_update ()
|
fset_bar_item_update ()
|
||||||
{
|
{
|
||||||
if (weechat_config_boolean (fset_config_look_help_bar))
|
if (weechat_config_boolean (fset_config_look_show_help_bar))
|
||||||
weechat_bar_item_update (FSET_BAR_ITEM_NAME);
|
weechat_bar_item_update (FSET_BAR_ITEM_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,15 +721,16 @@ fset_buffer_input_cb (const void *pointer, void *data,
|
|||||||
struct t_gui_buffer *buffer,
|
struct t_gui_buffer *buffer,
|
||||||
const char *input_data)
|
const char *input_data)
|
||||||
{
|
{
|
||||||
char *actions[][2] = { { "t", "toggle" },
|
char *actions[][2] = { { "t", "toggle" },
|
||||||
{ "-", "add -1" },
|
{ "-", "add -1" },
|
||||||
{ "+", "add 1" },
|
{ "+", "add 1" },
|
||||||
{ "r", "reset" },
|
{ "r", "reset" },
|
||||||
{ "u", "unset" },
|
{ "u", "unset" },
|
||||||
{ "s", "set" },
|
{ "s", "set" },
|
||||||
{ "a", "append" },
|
{ "a", "append" },
|
||||||
{ ",", "mark 1" },
|
{ ",", "mark 1" },
|
||||||
{ NULL, NULL } };
|
{ "v", "toggle_bar" },
|
||||||
|
{ NULL, NULL } };
|
||||||
char str_command[64];
|
char str_command[64];
|
||||||
const char *ptr_input;
|
const char *ptr_input;
|
||||||
int i;
|
int i;
|
||||||
@ -843,20 +844,21 @@ fset_buffer_set_callbacks ()
|
|||||||
void
|
void
|
||||||
fset_buffer_set_keys ()
|
fset_buffer_set_keys ()
|
||||||
{
|
{
|
||||||
char *keys[][2] = { { "meta-meta2-1~", "go 0" },
|
char *keys[][2] = { { "meta-meta2-1~", "go 0" },
|
||||||
{ "meta-meta2-4~", "go end" },
|
{ "meta-meta2-4~", "go end" },
|
||||||
{ "meta- ", "toggle" },
|
{ "meta- ", "toggle" },
|
||||||
{ "meta--", "add -1" },
|
{ "meta--", "add -1" },
|
||||||
{ "meta-+", "add 1" },
|
{ "meta-+", "add 1" },
|
||||||
{ "meta-fmeta-r", "reset" },
|
{ "meta-fmeta-r", "reset" },
|
||||||
{ "meta-fmeta-u", "unset" },
|
{ "meta-fmeta-u", "unset" },
|
||||||
{ "meta-ctrl-J", "set" },
|
{ "meta-ctrl-J", "set" },
|
||||||
{ "meta-ctrl-M", "set" },
|
{ "meta-ctrl-M", "set" },
|
||||||
{ "meta-fmeta-a", "append" },
|
{ "meta-fmeta-a", "append" },
|
||||||
{ "meta-,", "mark 1" },
|
{ "meta-,", "mark 1" },
|
||||||
{ "meta2-a", "mark -1" },
|
{ "meta2-a", "mark -1" },
|
||||||
{ "meta2-b", "mark 1" },
|
{ "meta2-b", "mark 1" },
|
||||||
{ NULL, NULL } };
|
{ "meta-v", "toggle_bar" },
|
||||||
|
{ NULL, NULL } };
|
||||||
char str_key[64], str_command[64];
|
char str_key[64], str_command[64];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -112,6 +112,12 @@ fset_command_fset (const void *pointer, void *data,
|
|||||||
return WEECHAT_RC_OK;
|
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)
|
if (weechat_strcasecmp (argv[1], "-refresh") == 0)
|
||||||
{
|
{
|
||||||
fset_bar_item_update ();
|
fset_bar_item_update ();
|
||||||
@ -461,6 +467,7 @@ fset_command_init ()
|
|||||||
"fset",
|
"fset",
|
||||||
N_("fast set WeeChat and plugins options"),
|
N_("fast set WeeChat and plugins options"),
|
||||||
N_("-bar"
|
N_("-bar"
|
||||||
|
" || -toggle_bar"
|
||||||
" || -refresh"
|
" || -refresh"
|
||||||
" || -up|-down [<number>]"
|
" || -up|-down [<number>]"
|
||||||
" || -go <line>|end"
|
" || -go <line>|end"
|
||||||
@ -472,39 +479,43 @@ fset_command_init ()
|
|||||||
" || -append"
|
" || -append"
|
||||||
" || -mark [<number>]"
|
" || -mark [<number>]"
|
||||||
" || filter"),
|
" || filter"),
|
||||||
N_(" -bar: add the fset bar\n"
|
N_(" -bar: add the help bar\n"
|
||||||
"-refresh: force the refresh of the \"fset\" bar item\n"
|
"-toggle_bar: toggle the help bar\n"
|
||||||
" -up: move the selected line up by \"number\" lines\n"
|
" -refresh: force the refresh of the \"fset\" bar item\n"
|
||||||
" -down: move the selected line down by \"number\" lines\n"
|
" -up: move the selected line up by \"number\" lines\n"
|
||||||
" -go: select a line by number, first line number is 0 "
|
" -down: move the selected line down by \"number\" lines\n"
|
||||||
|
" -go: select a line by number, first line number is 0 "
|
||||||
"(\"end\" to select the last line)\n"
|
"(\"end\" to select the last line)\n"
|
||||||
" -toggle: toggle the boolean value\n"
|
" -toggle: toggle the boolean value\n"
|
||||||
" -add: add \"value\", which can be a negative number "
|
" -add: add \"value\", which can be a negative number "
|
||||||
"(only for integers and colors)\n"
|
"(only for integers and colors)\n"
|
||||||
" -reset: reset the value of option\n"
|
" -reset: reset the value of option\n"
|
||||||
" -unset: unset the option\n"
|
" -unset: unset the option\n"
|
||||||
" -set: add the /set command in input to edit the value of "
|
" -set: add the /set command in input to edit the value of "
|
||||||
"option (move the cursor at the beginning of value)\n"
|
"option (move the cursor at the beginning of value)\n"
|
||||||
" -append: add the /set command to append something in the value "
|
" -append: add the /set command to append something in the value "
|
||||||
"of option (move the cursor at the end of value)\n"
|
"of option (move the cursor at the end of value)\n"
|
||||||
" -mark: toggle mark on the option and move \"number\" lines "
|
" -mark: toggle mark on the option and move \"number\" lines "
|
||||||
"(up/down, default is 1: one line down)\n"
|
"(up/down, default is 1: one line down)\n"
|
||||||
" filter: set a new filter to see only matching options (this "
|
" filter: set a new filter to see only matching options (this "
|
||||||
"filter can be used as input in fset buffer as well); allowed "
|
"filter can be used as input in fset buffer as well); allowed "
|
||||||
"formats are:\n"
|
"formats are:\n"
|
||||||
" * show all options (no filter)\n"
|
" * show all options (no filter)\n"
|
||||||
" f:xxx show only configuration file \"xxx\"\n"
|
" f:xxx show only configuration file \"xxx\"\n"
|
||||||
" t:xxx show only type \"xxx\" (beginning of type "
|
" t:xxx show only type \"xxx\" (beginning of type "
|
||||||
"name is allowed, both English and translated types are allowed)\n"
|
"name is allowed, both English and translated types are allowed)\n"
|
||||||
" d show only changed options\n"
|
" d show only changed options\n"
|
||||||
" d:xxx show only changed options with \"xxx\" in name\n"
|
" d:xxx show only changed options with \"xxx\" in "
|
||||||
" d=xxx show only changed options with \"xxx\" in value\n"
|
"name\n"
|
||||||
" d==xxx show only changed options with exact value \"xxx\"\n"
|
" d=xxx show only changed options with \"xxx\" in "
|
||||||
" =xxx show only options with \"xxx\" in value\n"
|
"value\n"
|
||||||
" ==xxx show only options with exact value \"xxx\"\n"
|
" d==xxx show only changed options with exact value "
|
||||||
" s:x,y sort options by fields x,y "
|
"\"xxx\"\n"
|
||||||
|
" =xxx show only options with \"xxx\" in value\n"
|
||||||
|
" ==xxx show only options with exact value \"xxx\"\n"
|
||||||
|
" s:x,y sort options by fields x,y "
|
||||||
"(see /help fset.look.sort)\n"
|
"(see /help fset.look.sort)\n"
|
||||||
" s: reset sort to its default value "
|
" s: reset sort to its default value "
|
||||||
"(see /help fset.look.sort)\n"
|
"(see /help fset.look.sort)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The lines with options are displayed using string evaluation "
|
"The lines with options are displayed using string evaluation "
|
||||||
@ -553,6 +564,7 @@ fset_command_init ()
|
|||||||
" shift+up mark/unmark option and move one line up\n"
|
" shift+up mark/unmark option and move one line up\n"
|
||||||
" $ refresh options (keep marked options)\n"
|
" $ refresh options (keep marked options)\n"
|
||||||
" $$ refresh options (unmark all options)\n"
|
" $$ refresh options (unmark all options)\n"
|
||||||
|
" v toggle help bar\n"
|
||||||
" q close fset buffer\n"
|
" q close fset buffer\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Note: spaces at beginning of input are ignored, so for example "
|
"Note: spaces at beginning of input are ignored, so for example "
|
||||||
|
@ -36,8 +36,8 @@ struct t_config_file *fset_config_file = NULL;
|
|||||||
|
|
||||||
struct t_config_option *fset_config_look_auto_unmark;
|
struct t_config_option *fset_config_look_auto_unmark;
|
||||||
struct t_config_option *fset_config_look_condition_catch_set;
|
struct t_config_option *fset_config_look_condition_catch_set;
|
||||||
struct t_config_option *fset_config_look_help_bar;
|
|
||||||
struct t_config_option *fset_config_look_marked_string;
|
struct t_config_option *fset_config_look_marked_string;
|
||||||
|
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_plugin_description;
|
||||||
struct t_config_option *fset_config_look_sort;
|
struct t_config_option *fset_config_look_sort;
|
||||||
struct t_config_option *fset_config_look_unmarked_string;
|
struct t_config_option *fset_config_look_unmarked_string;
|
||||||
@ -81,12 +81,12 @@ char *fset_config_eval_format_option_current = NULL;
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback for changes on option "fset.look.help_bar".
|
* Callback for changes on option "fset.look.show_help_bar".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
fset_config_change_help_bar_cb (const void *pointer, void *data,
|
fset_config_change_show_help_bar_cb (const void *pointer, void *data,
|
||||||
struct t_config_option *option)
|
struct t_config_option *option)
|
||||||
{
|
{
|
||||||
/* make C compiler happy */
|
/* make C compiler happy */
|
||||||
(void) pointer;
|
(void) pointer;
|
||||||
@ -283,15 +283,6 @@ fset_config_init ()
|
|||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
fset_config_look_help_bar = weechat_config_new_option (
|
|
||||||
fset_config_file, ptr_section,
|
|
||||||
"help_bar", "boolean",
|
|
||||||
N_("display help bar in fset buffer (description of option, "
|
|
||||||
"allowed values and default value)"),
|
|
||||||
NULL, 0, 0, "on", NULL, 0,
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
&fset_config_change_help_bar_cb, NULL, NULL,
|
|
||||||
NULL, NULL, NULL);
|
|
||||||
fset_config_look_marked_string = weechat_config_new_option (
|
fset_config_look_marked_string = weechat_config_new_option (
|
||||||
fset_config_file, ptr_section,
|
fset_config_file, ptr_section,
|
||||||
"marked_string", "string",
|
"marked_string", "string",
|
||||||
@ -301,6 +292,15 @@ fset_config_init ()
|
|||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
fset_config_look_show_help_bar = weechat_config_new_option (
|
||||||
|
fset_config_file, ptr_section,
|
||||||
|
"show_help_bar", "boolean",
|
||||||
|
N_("display help bar in fset buffer (description of option, "
|
||||||
|
"allowed values and default value)"),
|
||||||
|
NULL, 0, 0, "on", NULL, 0,
|
||||||
|
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_plugin_description = weechat_config_new_option (
|
||||||
fset_config_file, ptr_section,
|
fset_config_file, ptr_section,
|
||||||
"show_plugin_description", "boolean",
|
"show_plugin_description", "boolean",
|
||||||
|
@ -26,8 +26,8 @@ extern struct t_config_file *fset_config_file;
|
|||||||
|
|
||||||
extern struct t_config_option *fset_config_look_auto_unmark;
|
extern struct t_config_option *fset_config_look_auto_unmark;
|
||||||
extern struct t_config_option *fset_config_look_condition_catch_set;
|
extern struct t_config_option *fset_config_look_condition_catch_set;
|
||||||
extern struct t_config_option *fset_config_look_help_bar;
|
|
||||||
extern struct t_config_option *fset_config_look_marked_string;
|
extern struct t_config_option *fset_config_look_marked_string;
|
||||||
|
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_plugin_description;
|
||||||
extern struct t_config_option *fset_config_look_sort;
|
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_unmarked_string;
|
||||||
|
@ -58,7 +58,7 @@ fset_add_bar ()
|
|||||||
{
|
{
|
||||||
weechat_bar_new (
|
weechat_bar_new (
|
||||||
FSET_BAR_NAME, "off", "0", "window",
|
FSET_BAR_NAME, "off", "0", "window",
|
||||||
"${fset.look.help_bar} "
|
"${fset.look.show_help_bar} "
|
||||||
"&& ${buffer.full_name} == " FSET_PLUGIN_NAME "." FSET_BAR_NAME,
|
"&& ${buffer.full_name} == " FSET_PLUGIN_NAME "." FSET_BAR_NAME,
|
||||||
"top", "horizontal", "vertical", "3", "3",
|
"top", "horizontal", "vertical", "3", "3",
|
||||||
"default", "cyan", "default", "on",
|
"default", "cyan", "default", "on",
|
||||||
@ -98,7 +98,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
|||||||
|
|
||||||
fset_command_init ();
|
fset_command_init ();
|
||||||
|
|
||||||
if (weechat_config_boolean (fset_config_look_help_bar))
|
if (weechat_config_boolean (fset_config_look_show_help_bar))
|
||||||
fset_add_bar ();
|
fset_add_bar ();
|
||||||
|
|
||||||
fset_bar_item_update ();
|
fset_bar_item_update ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user