summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/fset/fset-buffer.c40
-rw-r--r--src/plugins/fset/fset-command.c24
-rw-r--r--src/plugins/fset/fset-option.c49
-rw-r--r--src/plugins/fset/fset-option.h5
4 files changed, 53 insertions, 65 deletions
diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c
index 9ee42d20f..9433c2c0f 100644
--- a/src/plugins/fset/fset-buffer.c
+++ b/src/plugins/fset/fset-buffer.c
@@ -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;
diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c
index e5468f051..f322b7c1a 100644
--- a/src/plugins/fset/fset-command.c
+++ b/src/plugins/fset/fset-command.c
@@ -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"
diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c
index acaa2084f..6e31e93a3 100644
--- a/src/plugins/fset/fset-option.c
+++ b/src/plugins/fset/fset-option.c
@@ -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,24 +1189,18 @@ 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 ();
+
+ fset_buffer_refresh (0);
}
/*
- * Unmarks all options.
+ * Mark/unmark options matching a filter.
*/
void
-fset_option_unmark_all ()
+fset_option_mark_options_matching_filter (const char *filter, int mark)
{
- int num_options, i;
+ int num_options, i, mark_old;
struct t_fset_option *ptr_fset_option;
num_options = weechat_arraylist_size (fset_options);
@@ -1217,20 +1208,27 @@ fset_option_unmark_all ()
{
ptr_fset_option = weechat_arraylist_get (fset_options, i);
if (ptr_fset_option)
- ptr_fset_option->marked = 0;
+ {
+ mark_old = ptr_fset_option->marked;
+ if (fset_option_match_filter (ptr_fset_option, filter))
+ ptr_fset_option->marked = mark;
+ else
+ ptr_fset_option->marked = mark ^ 1;
+ if (mark_old != ptr_fset_option->marked)
+ fset_option_count_marked += (ptr_fset_option->marked) ? 1 : -1;
+ }
}
- fset_option_count_marked = 0;
fset_buffer_refresh (0);
}
/*
- * Mark/unmark options matching a filter.
+ * Unmarks all options.
*/
void
-fset_option_mark_options_matching_filter (const char *filter, int mark)
+fset_option_unmark_all ()
{
- int num_options, i, mark_old;
+ int num_options, i;
struct t_fset_option *ptr_fset_option;
num_options = weechat_arraylist_size (fset_options);
@@ -1238,16 +1236,9 @@ fset_option_mark_options_matching_filter (const char *filter, int mark)
{
ptr_fset_option = weechat_arraylist_get (fset_options, i);
if (ptr_fset_option)
- {
- mark_old = ptr_fset_option->marked;
- if (fset_option_match_filter (ptr_fset_option, filter))
- ptr_fset_option->marked = mark;
- else
- ptr_fset_option->marked = mark ^ 1;
- if (mark_old != ptr_fset_option->marked)
- fset_option_count_marked += (ptr_fset_option->marked) ? 1 : -1;
- }
+ ptr_fset_option->marked = 0;
}
+ fset_option_count_marked = 0;
fset_buffer_refresh (0);
}
diff --git a/src/plugins/fset/fset-option.h b/src/plugins/fset/fset-option.h
index 10af4e4b2..ff239f056 100644
--- a/src/plugins/fset/fset-option.h
+++ b/src/plugins/fset/fset-option.h
@@ -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,