mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 22:36:38 +02:00
fset: first move up one line before toggling mark with shift+up
This commit is contained in:
@@ -1018,28 +1018,28 @@ void
|
||||
fset_buffer_set_keys ()
|
||||
{
|
||||
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 0" },
|
||||
{ "meta2-a", "/fset -mark -1" },
|
||||
{ "meta2-b", "/fset -mark 1" },
|
||||
{ "ctrl-L", "/fset -refresh" },
|
||||
{ "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" },
|
||||
{ "meta2-a", "/fset -up; /fset -mark" },
|
||||
{ "meta2-b", "/fset -mark; /fset -down" },
|
||||
{ "ctrl-L", "/fset -refresh" },
|
||||
{ "meta-p", "/mute /set fset.look.show_plugins_desc toggle", },
|
||||
{ "meta-v", "/mute /set fset.look.show_help_bar toggle" },
|
||||
{ "ctrl-X", "/fset -format" },
|
||||
{ NULL, NULL },
|
||||
{ "ctrl-X", "/fset -format" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
char str_key[64];
|
||||
int i;
|
||||
|
||||
@@ -368,8 +368,7 @@ fset_command_fset (const void *pointer, void *data,
|
||||
if (weechat_strcasecmp (argv[1], "-mark") == 0)
|
||||
{
|
||||
fset_command_get_option (&ptr_fset_option, &ptr_option);
|
||||
value = fset_command_get_int_arg (argc, argv, 2, 1);
|
||||
fset_option_toggle_mark (ptr_fset_option, ptr_option, value);
|
||||
fset_option_toggle_mark (ptr_fset_option, ptr_option);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -589,7 +588,7 @@ fset_command_init ()
|
||||
" || -unset"
|
||||
" || -set"
|
||||
" || -append"
|
||||
" || -mark [<number>]"
|
||||
" || -mark"
|
||||
" || -format"
|
||||
" || -export [-help|-nohelp] <filename>"
|
||||
" || filter"),
|
||||
@@ -613,8 +612,7 @@ fset_command_init ()
|
||||
"option (move the cursor at the beginning of value)\n"
|
||||
" -append: add the /set command to append something in the value "
|
||||
"of option (move the cursor at the end of value)\n"
|
||||
" -mark: toggle mark on the option and move \"number\" lines "
|
||||
"(up/down, default is 1: one line down)\n"
|
||||
" -mark: toggle mark\n"
|
||||
" -format: switch to the next available format\n"
|
||||
" -export: export the options and values displayed in a file "
|
||||
"(each line has format: \"/set name value\" or \"/unset name\")\n"
|
||||
@@ -711,21 +709,21 @@ fset_command_init ()
|
||||
" alt+f, alt+u u unset value\n"
|
||||
" alt+enter s set value\n"
|
||||
" alt+f, alt+a a append to value\n"
|
||||
" alt+',' , mark/unmark option and move one line down\n"
|
||||
" alt+',' , mark/unmark option\n"
|
||||
" shift+up move one line up and mark/unmark option\n"
|
||||
" shift+down mark/unmark option and move one line down\n"
|
||||
" shift+up mark/unmark option and move one line up\n"
|
||||
" m:xxx mark options displayed that are "
|
||||
"matching filter \"xxx\" (any filter on option or value is allowed, "
|
||||
"see filters above)\n"
|
||||
" u:xxx unmark options displayed that are "
|
||||
"matching filter \"xxx\" (any filter on option or value is allowed, "
|
||||
"see filters above)\n"
|
||||
"\n"
|
||||
"Other keys and input on fset buffer:\n"
|
||||
" ctrl+L refresh options and whole screen "
|
||||
"(command: /fset -refresh)\n"
|
||||
" $ refresh options (keep marked options)\n"
|
||||
" $$ refresh options (unmark all options)\n"
|
||||
" m:xxx mark options displayed and matching "
|
||||
"filter \"xxx\" (any filter on option or value is allowed, "
|
||||
"see filters above)\n"
|
||||
" u:xxx unmark options displayed and matching "
|
||||
"filter \"xxx\" (any filter on option or value is allowed, "
|
||||
"see filters above)\n"
|
||||
" p toggle plugin description options "
|
||||
"(plugins.desc.*)\n"
|
||||
" v toggle help bar\n"
|
||||
|
||||
@@ -1179,11 +1179,8 @@ fset_option_set (struct t_fset_option *fset_option,
|
||||
|
||||
void
|
||||
fset_option_toggle_mark (struct t_fset_option *fset_option,
|
||||
struct t_config_option *option,
|
||||
int value)
|
||||
struct t_config_option *option)
|
||||
{
|
||||
int num_options, line;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) option;
|
||||
|
||||
@@ -1192,34 +1189,7 @@ fset_option_toggle_mark (struct t_fset_option *fset_option,
|
||||
|
||||
fset_option->marked ^= 1;
|
||||
fset_option_count_marked += (fset_option->marked) ? 1 : -1;
|
||||
num_options = weechat_arraylist_size (fset_options);
|
||||
line = fset_buffer_selected_line + value;
|
||||
if (line < 0)
|
||||
line = 0;
|
||||
else if (line >= num_options)
|
||||
line = num_options - 1;
|
||||
fset_buffer_set_current_line (line);
|
||||
fset_buffer_check_line_outside_window ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarks all options.
|
||||
*/
|
||||
|
||||
void
|
||||
fset_option_unmark_all ()
|
||||
{
|
||||
int num_options, i;
|
||||
struct t_fset_option *ptr_fset_option;
|
||||
|
||||
num_options = weechat_arraylist_size (fset_options);
|
||||
for (i = 0; i < num_options; i++)
|
||||
{
|
||||
ptr_fset_option = weechat_arraylist_get (fset_options, i);
|
||||
if (ptr_fset_option)
|
||||
ptr_fset_option->marked = 0;
|
||||
}
|
||||
fset_option_count_marked = 0;
|
||||
fset_buffer_refresh (0);
|
||||
}
|
||||
|
||||
@@ -1251,6 +1221,27 @@ fset_option_mark_options_matching_filter (const char *filter, int mark)
|
||||
fset_buffer_refresh (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarks all options.
|
||||
*/
|
||||
|
||||
void
|
||||
fset_option_unmark_all ()
|
||||
{
|
||||
int num_options, i;
|
||||
struct t_fset_option *ptr_fset_option;
|
||||
|
||||
num_options = weechat_arraylist_size (fset_options);
|
||||
for (i = 0; i < num_options; i++)
|
||||
{
|
||||
ptr_fset_option = weechat_arraylist_get (fset_options, i);
|
||||
if (ptr_fset_option)
|
||||
ptr_fset_option->marked = 0;
|
||||
}
|
||||
fset_option_count_marked = 0;
|
||||
fset_buffer_refresh (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exports options currently displayed in fset buffer.
|
||||
*
|
||||
|
||||
@@ -85,11 +85,10 @@ extern void fset_option_set (struct t_fset_option *fset_option,
|
||||
struct t_gui_buffer *buffer,
|
||||
int append);
|
||||
extern void fset_option_toggle_mark (struct t_fset_option *fset_option,
|
||||
struct t_config_option *option,
|
||||
int value);
|
||||
extern void fset_option_unmark_all ();
|
||||
struct t_config_option *option);
|
||||
extern void fset_option_mark_options_matching_filter (const char *filter,
|
||||
int mark);
|
||||
extern void fset_option_unmark_all ();
|
||||
extern int fset_option_export (const char *filename, int with_help);
|
||||
extern int fset_option_config_cb (const void *pointer,
|
||||
void *data,
|
||||
|
||||
Reference in New Issue
Block a user