2 # Copyright (C) 2008-2013 Sebastien Helleu <flashcode@flashtux.org>
3 # Copyright (C) 2010-2012 Nils Görs <weechatter@arcor.de>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Set WeeChat and plugins options interactively.
22 # 2014-01-16, luz <ne.tetewi@gmail.com>:
23 # version 3.3: fix bug with column alignment in iset buffer when option
24 # name contains unicode characters
25 # 2013-08-03, Sebastien Helleu <flashcode@flashtux.org>:
26 # version 3.2: allow "q" as input in iset buffer to close it
27 # 2013-07-14, Sebastien Helleu <flashcode@flashtux.org>:
28 # version 3.1: remove unneeded calls to iset_refresh() in mouse callback
29 # (faster mouse actions when lot of options are displayed),
30 # fix bug when clicking on a line after the last option displayed
31 # 2013-04-30, arza <arza@arza.us>:
32 # version 3.0: simpler title, fix refresh on unset
33 # 2012-12-16, nils_2 <weechatter@arcor.de>:
34 # version 2.9: fix focus window with iset buffer on mouse click
35 # 2012-08-25, nils_2 <weechatter@arcor.de>:
36 # version 2.8: most important key and mouse bindings for iset buffer added to title-bar (idea The-Compiler)
37 # 2012-07-31, nils_2 <weechatter@arcor.de>:
38 # version 2.7: add combined option and value search (see /help iset)
39 # : add exact value search (see /help iset)
40 # : fix problem with metacharacter in value search
41 # : fix use of uninitialized value for unset option and reset value of option
42 # 2012-07-25, nils_2 <weechatter@arcor.de>:
43 # version 2.6: switch to iset buffer (if existing) when command /iset is called with arguments
44 # 2012-03-17, Sebastien Helleu <flashcode@flashtux.org>:
45 # version 2.5: fix check of sections when creating config file
46 # 2012-03-09, Sebastien Helleu <flashcode@flashtux.org>:
47 # version 2.4: fix reload of config file
48 # 2012-02-02, nils_2 <weechatter@arcor.de>:
49 # version 2.3: fixed: refresh problem with new search results and cursor was outside window.
50 # : add: new option "current_line" in title bar
51 # version 2.2: fixed: refresh error when toggling plugins description
52 # 2011-11-05, nils_2 <weechatter@arcor.de>:
53 # version 2.1: use own config file (iset.conf), fix own help color (used immediately)
54 # 2011-10-16, nils_2 <weechatter@arcor.de>:
55 # version 2.0: add support for left-mouse-button and more sensitive mouse gesture (for integer/color options)
56 # add help text for mouse support
57 # 2011-09-20, Sebastien Helleu <flashcode@flashtux.org>:
58 # version 1.9: add mouse support, fix iset buffer, fix errors on first load under FreeBSD
59 # 2011-07-21, nils_2 <weechatter@arcor.de>:
60 # version 1.8: added: option "show_plugin_description" (alt+p)
61 # fixed: typos in /help iset (lower case for alt+'x' keys)
62 # 2011-05-29, nils_2 <weechatter@arcor.de>:
63 # version 1.7: added: version check for future needs
64 # added: new option (scroll_horiz) and usage of scroll_horiz function (weechat >= 0.3.6 required)
65 # fixed: help_bar did not pop up immediately using key-shortcut
66 # 2011-02-19, nils_2 <weechatter@arcor.de>:
67 # version 1.6: added: display of all possible values in help bar (show_help_extra_info)
68 # fixed: external user options never loaded when starting iset first time
69 # 2011-02-13, Sebastien Helleu <flashcode@flashtux.org>:
70 # version 1.5: use new help format for command arguments
71 # 2011-02-03, nils_2 <weechatter@arcor.de>:
72 # version 1.4: fixed: restore value filter after /upgrade using buffer local variable.
73 # 2011-01-14, nils_2 <weechatter@arcor.de>:
74 # version 1.3: added function to search for values (option value_search_char).
76 # 2010-12-26, Sebastien Helleu <flashcode@flashtux.org>:
77 # version 1.2: improve speed of /upgrade when iset buffer is open,
78 # restore filter used after /upgrade using buffer local variable,
79 # use /iset filter argument if buffer is open.
80 # 2010-11-21, drubin <drubin+weechat@smartcube.co.za>:
81 # version 1.1.1: fix bugs with cursor position
82 # 2010-11-20, nils_2 <weechatter@arcor.de>:
83 # version 1.1: cursor position set to value
84 # 2010-08-03, Sebastien Helleu <flashcode@flashtux.org>:
85 # version 1.0: move misplaced call to infolist_free()
86 # 2010-02-02, rettub <rettub@gmx.net>:
87 # version 0.9: turn all the help stuff off if option 'show_help_bar' is 'off',
88 # new key binding <alt>-<v> to toggle help_bar and help stuff on/off
89 # 2010-01-30, nils_2 <weechatter@arcor.de>:
90 # version 0.8: fix error when option does not exist
91 # 2010-01-24, Sebastien Helleu <flashcode@flashtux.org>:
92 # version 0.7: display iset bar only on iset buffer
93 # 2010-01-22, nils_2 <weechatter@arcor.de> and drubin:
94 # version 0.6: add description in a bar, fix singular/plural bug in title bar,
95 # fix selected line when switching buffer
96 # 2009-06-21, Sebastien Helleu <flashcode@flashtux.org>:
97 # version 0.5: fix bug with iset buffer after /upgrade
98 # 2009-05-02, Sebastien Helleu <flashcode@flashtux.org>:
99 # version 0.4: sync with last API changes
100 # 2009-01-04, Sebastien Helleu <flashcode@flashtux.org>:
101 # version 0.3: open iset buffer when /iset command is executed
102 # 2009-01-04, Sebastien Helleu <flashcode@flashtux.org>:
103 # version 0.2: use null values for options, add colors, fix refresh bugs,
104 # use new keys to reset/unset options, sort options by name,
105 # display number of options in buffer's title
106 # 2008-11-05, Sebastien Helleu <flashcode@flashtux.org>:
107 # version 0.1: first official version
108 # 2008-04-19, Sebastien Helleu <flashcode@flashtux.org>:
113 my $PRGNAME = "iset";
115 my $DESCR = "Interactive Set for configuration options";
116 my $AUTHOR = "Sebastien Helleu <flashcode\@flashtux.org>";
117 my $LICENSE = "GPL3";
119 my $ISET_CONFIG_FILE_NAME = "iset";
121 my $iset_config_file;
122 my $iset_buffer = "";
123 my $wee_version_number = 0;
125 my @options_names = ();
126 my @options_types = ();
127 my @options_values = ();
128 my @options_is_null = ();
129 my $option_max_length = 0;
130 my $current_line = 0;
132 my $description = "";
133 my $options_name_copy = "";
134 my $iset_filter_title = "";
135 # search modes: 0 = index() on value, 1 = grep() on value, 2 = grep() on option, 3 = grep on option & value
137 my $search_value = "";
138 my $help_text_keys = "alt + space: toggle, +/-: increase/decrease, enter: change, ir: reset, iu: unset, v: toggle help bar";
139 my $help_text_mouse = "Mouse: left: select, right: toggle/set, right + drag left/right: increase/decrease";
142 my %mouse_keys = ("\@chat(perl.$PRGNAME):button1" => "hsignal:iset_mouse",
143 "\@chat(perl.$PRGNAME):button2*" => "hsignal:iset_mouse",
144 "\@chat(perl.$PRGNAME):wheelup" => "/repeat 5 /iset **up",
145 "\@chat(perl.$PRGNAME):wheeldown" => "/repeat 5 /iset **down");
150 if ($iset_buffer ne "")
152 my $current_line_counter = "";
153 $current_line_counter = ($current_line + 1) . "/" if (weechat
::config_boolean
($options_iset{"show_current_line"}) == 1);
154 my $show_filter = "";
155 if ($search_mode eq 0)
157 $iset_filter_title = "(value) ";
158 $show_filter = $search_value;
159 if ( substr($show_filter,0,1) eq weechat
::config_string
($options_iset{"value_search_char"}) )
161 $show_filter = substr($show_filter,1,length($show_filter));
164 elsif ($search_mode eq 1)
166 $iset_filter_title = "(value) ";
167 $show_filter = "*".$search_value."*";
169 elsif ($search_mode eq 2)
171 $iset_filter_title = "";
172 $filter = "*" if ($filter eq "");
173 $show_filter = $filter;
175 elsif ($search_mode eq 3)
177 $iset_filter_title = "(option) ";
178 $show_filter = $filter
179 .weechat
::color
("default")
181 .weechat
::color
("yellow")
182 ."*".$search_value."*";
184 weechat
::buffer_set
($iset_buffer, "title",
186 .weechat
::color
("yellow")
188 .weechat
::color
("default")." | "
189 .$current_line_counter
198 sub iset_create_filter
201 if ( $search_mode == 3 )
203 my @cmd_array = split(/ /,$filter);
204 my $array_count = @cmd_array;
205 $filter = $cmd_array[0];
206 $filter = $cmd_array[0] . " " . $cmd_array[1] if ( $array_count >2 );
208 $filter = "$1.*" if ($filter =~ /f (.*)/); # search file
209 $filter = "*.$1.*" if ($filter =~ /s (.*)/); # search section
210 if ((substr($filter, 0, 1) ne "*") && (substr($filter, -1, 1) ne "*"))
212 $filter = "*".$filter."*";
214 if ($iset_buffer ne "")
216 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_filter", $filter);
220 sub iset_buffer_input
222 my ($data, $buffer, $string) = ($_[0], $_[1], $_[2]);
225 weechat
::buffer_close
($buffer);
226 return weechat
::WEECHAT_RC_OK
;
229 my @cmd_array = split(/ /,$string);
230 my $array_count = @cmd_array;
231 my $string2 = substr($string, 0, 1);
232 if ($string2 eq weechat
::config_string
($options_iset{"value_search_char"})
233 or (defined $cmd_array[0] and $cmd_array[0] eq weechat
::config_string
($options_iset{"value_search_char"}).weechat
::config_string
($options_iset{"value_search_char"})) )
236 $search_value = substr($string, 1);
237 iset_get_values
($search_value);
238 if ($iset_buffer ne "")
240 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
246 if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s")
248 if ( defined $cmd_array[1] and substr($cmd_array[1], 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"})
249 or defined $cmd_array[2] and substr($cmd_array[2], 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"}) )
252 $search_value = substr($cmd_array[1], 1); # cut value_search_char
253 $search_value = substr($cmd_array[2], 1) if ( $array_count > 2); # cut value_search_char
256 if ( $search_mode == 3)
258 iset_create_filter
($string);
259 iset_get_options
($search_value);
262 iset_create_filter
($string);
263 iset_get_options
("");
266 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
267 weechat
::buffer_clear
($buffer);
270 return weechat
::WEECHAT_RC_OK
;
273 sub iset_buffer_close
277 return weechat
::WEECHAT_RC_OK
;
283 $iset_buffer = weechat
::buffer_search
($LANG, $PRGNAME);
284 if ($iset_buffer eq "")
286 $iset_buffer = weechat
::buffer_new
($PRGNAME, "iset_buffer_input", "", "iset_buffer_close", "");
290 my $new_filter = weechat
::buffer_get_string
($iset_buffer, "localvar_iset_filter");
291 $search_mode = weechat
::buffer_get_string
($iset_buffer, "localvar_iset_search_mode");
292 $search_value = weechat
::buffer_get_string
($iset_buffer, "localvar_iset_search_value");
293 $filter = $new_filter if ($new_filter ne "");
295 if ($iset_buffer ne "")
297 weechat
::buffer_set
($iset_buffer, "type", "free");
299 weechat
::buffer_set
($iset_buffer, "key_bind_ctrl-L", "/iset **refresh");
300 weechat
::buffer_set
($iset_buffer, "key_bind_meta2-A", "/iset **up");
301 weechat
::buffer_set
($iset_buffer, "key_bind_meta2-B", "/iset **down");
302 weechat
::buffer_set
($iset_buffer, "key_bind_meta2-23~", "/iset **left");
303 weechat
::buffer_set
($iset_buffer, "key_bind_meta2-24~" , "/iset **right");
304 weechat
::buffer_set
($iset_buffer, "key_bind_meta- ", "/iset **toggle");
305 weechat
::buffer_set
($iset_buffer, "key_bind_meta-+", "/iset **incr");
306 weechat
::buffer_set
($iset_buffer, "key_bind_meta--", "/iset **decr");
307 weechat
::buffer_set
($iset_buffer, "key_bind_meta-imeta-r", "/iset **reset");
308 weechat
::buffer_set
($iset_buffer, "key_bind_meta-imeta-u", "/iset **unset");
309 weechat
::buffer_set
($iset_buffer, "key_bind_meta-ctrl-J", "/iset **set");
310 weechat
::buffer_set
($iset_buffer, "key_bind_meta-ctrl-M", "/iset **set");
311 weechat
::buffer_set
($iset_buffer, "key_bind_meta-meta2-1~", "/iset **scroll_top");
312 weechat
::buffer_set
($iset_buffer, "key_bind_meta-meta2-4~", "/iset **scroll_bottom");
313 weechat
::buffer_set
($iset_buffer, "key_bind_meta-v", "/iset **toggle_help");
314 weechat
::buffer_set
($iset_buffer, "key_bind_meta-p", "/iset **toggle_show_plugin_desc");
315 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_filter", $filter);
316 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
317 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
323 my $var_value = $_[0];
324 $var_value = "" if (not defined $var_value);
325 $var_value = lc($var_value);
326 $search_value = $var_value;
330 @options_values = ();
331 @options_is_null = ();
332 $option_max_length = 0;
333 my %options_internal = ();
339 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $var_value) if ($search_mode == 3);
341 my $infolist = weechat
::infolist_get
("option", "", $filter);
342 while (weechat
::infolist_next
($infolist))
344 $key = sprintf("%08d", $i);
345 my $name = weechat
::infolist_string
($infolist, "full_name");
346 next if (weechat
::config_boolean
($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1);
347 my $type = weechat
::infolist_string
($infolist, "type");
348 my $value = weechat
::infolist_string
($infolist, "value");
349 my $is_null = weechat
::infolist_integer
($infolist, "value_is_null");
350 if ($search_mode == 3)
352 my $value = weechat
::infolist_string
($infolist, "value");
353 if ( grep /\Q$var_value/,lc($value) )
355 $options_internal{$name}{"type"} = $type;
356 $options_internal{$name}{"value"} = $value;
357 $options_internal{$name}{"is_null"} = $is_null;
358 $option_max_length = length($name) if (length($name) > $option_max_length);
359 $iset_struct{$key} = $options_internal{$name};
360 push(@iset_focus, $iset_struct{$key});
365 $options_internal{$name}{"type"} = $type;
366 $options_internal{$name}{"value"} = $value;
367 $options_internal{$name}{"is_null"} = $is_null;
368 $option_max_length = length($name) if (length($name) > $option_max_length);
369 $iset_struct{$key} = $options_internal{$name};
370 push(@iset_focus, $iset_struct{$key});
374 weechat
::infolist_free
($infolist);
376 foreach my $name (sort keys %options_internal)
378 push(@options_names, $name);
379 push(@options_types, $options_internal{$name}{"type"});
380 push(@options_values, $options_internal{$name}{"value"});
381 push(@options_is_null, $options_internal{$name}{"is_null"});
387 my $var_value = $_[0];
388 $var_value = lc($var_value);
389 if (substr($var_value,0,1) eq weechat
::config_string
($options_iset{"value_search_char"}) and $var_value ne weechat
::config_string
($options_iset{"value_search_char"}))
391 $var_value = substr($var_value,1,length($var_value));
394 iset_search_values
($var_value,$search_mode);
395 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
396 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $var_value);
397 $search_value = $var_value;
399 sub iset_search_values
401 my ($var_value,$search_mode) = ($_[0],$_[1]);
404 @options_values = ();
405 @options_is_null = ();
406 $option_max_length = 0;
407 my %options_internal = ();
409 my $infolist = weechat
::infolist_get
("option", "", "*");
410 while (weechat
::infolist_next
($infolist))
412 my $name = weechat
::infolist_string
($infolist, "full_name");
413 next if (weechat
::config_boolean
($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1);
414 my $type = weechat
::infolist_string
($infolist, "type");
415 my $is_null = weechat
::infolist_integer
($infolist, "value_is_null");
416 my $value = weechat
::infolist_string
($infolist, "value");
419 if ( grep /\Q$var_value/,lc($value) )
421 $options_internal{$name}{"type"} = $type;
422 $options_internal{$name}{"value"} = $value;
423 $options_internal{$name}{"is_null"} = $is_null;
424 $option_max_length = length($name) if (length($name) > $option_max_length);
429 # if ($value =~ /\Q$var_value/si)
430 if (lc($value) eq $var_value)
432 $options_internal{$name}{"type"} = $type;
433 $options_internal{$name}{"value"} = $value;
434 $options_internal{$name}{"is_null"} = $is_null;
435 $option_max_length = length($name) if (length($name) > $option_max_length);
440 weechat
::infolist_free
($infolist);
441 foreach my $name (sort keys %options_internal)
443 push(@options_names, $name);
444 push(@options_types, $options_internal{$name}{"type"});
445 push(@options_values, $options_internal{$name}{"value"});
446 push(@options_is_null, $options_internal{$name}{"is_null"});
450 sub iset_refresh_line
452 if ($iset_buffer ne "")
455 if ($y <= $#options_names)
457 return if (! defined($options_types[$y]));
458 my $format = sprintf("%%s%%s%%s %%s %%-7s %%s %%s%%s%%s");
460 if ($wee_version_number >= 0x00040200)
462 $padding = " " x
($option_max_length - weechat
::strlen_screen
($options_names[$y]));
466 $padding = " " x
($option_max_length - length($options_names[$y]));
469 $around = "\"" if ((!$options_is_null[$y]) && ($options_types[$y] eq "string"));
471 my $color1 = weechat
::color
(weechat
::config_color
($options_iset{"color_option"}));
472 my $color2 = weechat
::color
(weechat
::config_color
($options_iset{"color_type"}));
474 if ($options_is_null[$y])
476 $color3 = weechat
::color
(weechat
::config_color
($options_iset{"color_value_undef"}));
480 $color3 = weechat
::color
(weechat
::config_color
($options_iset{"color_value"}));
482 if ($y == $current_line)
484 $color1 = weechat
::color
(weechat
::config_color
($options_iset{"color_option_selected"}).",".weechat
::config_color
($options_iset{"color_bg_selected"}));
485 $color2 = weechat
::color
(weechat
::config_color
($options_iset{"color_type_selected"}).",".weechat
::config_color
($options_iset{"color_bg_selected"}));
486 if ($options_is_null[$y])
488 $color3 = weechat
::color
(weechat
::config_color
($options_iset{"color_value_undef_selected"}).",".weechat
::config_color
($options_iset{"color_bg_selected"}));
492 $color3 = weechat
::color
(weechat
::config_color
($options_iset{"color_value_selected"}).",".weechat
::config_color
($options_iset{"color_bg_selected"}));
495 my $value = $options_values[$y];
496 $value = "(undef)" if ($options_is_null[$y]);
497 my $strline = sprintf($format,
498 $color1, $options_names[$y], $padding,
499 $color2, $options_types[$y],
500 $color3, $around, $value, $around);
501 weechat
::print_y
($iset_buffer, $y, $strline);
509 if (($iset_buffer ne "") && ($#options_names >= 0))
511 foreach my $y (0 .. $#options_names)
513 iset_refresh_line
($y);
517 weechat
::bar_item_update
("isetbar_help") if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1);
520 sub iset_full_refresh
522 $iset_buffer = weechat
::buffer_search
($LANG, $PRGNAME);
523 if ($iset_buffer ne "")
525 weechat
::buffer_clear
($iset_buffer) unless defined $_[0]; # iset_full_refresh(1) does a full refresh without clearing buffer
526 # search for "*" in $filter.
527 if ($filter =~ m/\*/ and $search_mode == 2)
529 iset_get_options
("");
533 if ($search_mode == 0)
535 $search_value = "=" . $search_value;
536 iset_get_values
($search_value);
538 elsif ($search_mode == 1)
540 iset_get_values
($search_value);
542 elsif ($search_mode == 3)
544 iset_create_filter
($filter);
545 iset_get_options
($search_value);
548 if (weechat
::config_boolean
($options_iset{"show_plugin_description"}) == 1)
550 iset_set_current_line
($current_line);
553 $current_line = $#options_names if ($current_line > $#options_names);
556 weechat
::command
($iset_buffer, "/window refresh");
560 sub iset_set_current_line
562 my $new_current_line = $_[0];
563 if ($new_current_line >= 0)
565 my $old_current_line = $current_line;
566 $current_line = $new_current_line;
567 $current_line = $#options_names if ($current_line > $#options_names);
568 if ($old_current_line != $current_line)
570 iset_refresh_line
($old_current_line);
571 iset_refresh_line
($current_line);
572 weechat
::bar_item_update
("isetbar_help") if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1);
577 sub iset_signal_window_scrolled_cb
579 my ($data, $signal, $signal_data) = ($_[0], $_[1], $_[2]);
580 if ($iset_buffer ne "")
582 my $infolist = weechat
::infolist_get
("window", $signal_data, "");
583 if (weechat
::infolist_next
($infolist))
585 if (weechat
::infolist_pointer
($infolist, "buffer") eq $iset_buffer)
587 my $old_current_line = $current_line;
588 my $new_current_line = $current_line;
589 my $start_line_y = weechat
::infolist_integer
($infolist, "start_line_y");
590 my $chat_height = weechat
::infolist_integer
($infolist, "chat_height");
591 $new_current_line += $chat_height if ($new_current_line < $start_line_y);
592 $new_current_line -= $chat_height if ($new_current_line >= $start_line_y + $chat_height);
593 $new_current_line = $start_line_y if ($new_current_line < $start_line_y);
594 $new_current_line = $start_line_y + $chat_height - 1 if ($new_current_line >= $start_line_y + $chat_height);
595 iset_set_current_line
($new_current_line);
598 weechat
::infolist_free
($infolist);
601 return weechat
::WEECHAT_RC_OK
;
604 sub iset_get_window_number
606 if ($iset_buffer ne "")
608 my $window = weechat
::window_search_with_buffer
($iset_buffer);
609 return "-window ".weechat
::window_get_integer
($window, "number")." " if ($window ne "");
614 sub iset_check_line_outside_window
616 if ($iset_buffer ne "")
619 if ($wee_version_number >= 0x00030500)
621 my $window = weechat
::window_search_with_buffer
($iset_buffer);
622 $infolist = weechat
::infolist_get
("window", $window, "") if $window;
626 $infolist = weechat
::infolist_get
("window", "", "current");
630 if (weechat
::infolist_next
($infolist))
632 my $start_line_y = weechat
::infolist_integer
($infolist, "start_line_y");
633 my $chat_height = weechat
::infolist_integer
($infolist, "chat_height");
634 my $window_number = "";
635 if ($wee_version_number >= 0x00030500)
637 $window_number = "-window ".weechat
::infolist_integer
($infolist, "number")." ";
639 if ($start_line_y > $current_line)
641 weechat
::command
($iset_buffer, "/window scroll ".$window_number."-".($start_line_y - $current_line));
645 if ($start_line_y <= $current_line - $chat_height)
647 weechat
::command
($iset_buffer, "/window scroll ".$window_number."+".($current_line - $start_line_y - $chat_height + 1));
652 weechat
::infolist_free
($infolist);
657 sub iset_get_option_name_index
659 my $option_name = $_[0];
661 while ($index <= $#options_names)
663 return -1 if ($options_names[$index] gt $option_name);
664 return $index if ($options_names[$index] eq $option_name);
672 my ($data, $option_name, $value) = ($_[0], $_[1], $_[2]);
674 if ($iset_buffer ne "")
676 return weechat
::WEECHAT_RC_OK
if (weechat
::info_get
("weechat_upgrading", "") eq "1");
678 my $index = iset_get_option_name_index
($option_name);
681 # refresh info about changed option
682 my $infolist = weechat
::infolist_get
("option", "", $option_name);
685 weechat
::infolist_next
($infolist);
686 if (weechat
::infolist_fields
($infolist))
688 $options_types[$index] = weechat
::infolist_string
($infolist, "type");
689 $options_values[$index] = weechat
::infolist_string
($infolist, "value");
690 $options_is_null[$index] = weechat
::infolist_integer
($infolist, "value_is_null");
691 iset_refresh_line
($index);
692 iset_title
() if ($option_name eq "iset.look.show_current_line");
696 iset_full_refresh
(1); # if not found, refresh fully without clearing buffer
697 weechat
::print_y
($iset_buffer, $#options_names + 1, "");
699 weechat
::infolist_free
($infolist);
704 iset_full_refresh
() if ($option_name ne "weechat.bar.isetbar.hidden");
708 return weechat
::WEECHAT_RC_OK
;
713 my ($option, $value) = ($_[0],$_[1]);
714 if (defined $option and defined $value)
716 $option = weechat
::config_get
($option);
717 weechat
::config_option_set
($option, $value, 1) if ($option ne "");
721 sub iset_reset_option
726 $option = weechat
::config_get
($option);
727 weechat
::config_option_reset
($option, 1) if ($option ne "");
731 sub iset_unset_option
736 $option = weechat
::config_get
($option);
737 weechat
::config_option_unset
($option) if ($option ne "");
744 my ($data, $buffer, $args) = ($_[0], $_[1], $_[2]);
746 # $search_value = "";
747 if (($args ne "") && (substr($args, 0, 2) ne "**"))
749 my @cmd_array = split(/ /,$args);
750 my $array_count = @cmd_array;
751 if (substr($args, 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"})
752 or (defined $cmd_array[0] and $cmd_array[0] eq weechat
::config_string
($options_iset{"value_search_char"}).weechat
::config_string
($options_iset{"value_search_char"})) )
755 my $search_value = substr($args, 1); # cut value_search_char
756 if ($iset_buffer ne "")
758 weechat
::buffer_clear
($iset_buffer);
759 weechat
::command
($iset_buffer, "/window refresh");
761 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
762 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
764 iset_get_values
($search_value);
766 weechat
::buffer_set
($iset_buffer, "display", "1");
767 # $filter = $var_value;
768 return weechat
::WEECHAT_RC_OK
;
775 if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s")
777 if ( defined $cmd_array[1] and substr($cmd_array[1], 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"})
778 or defined $cmd_array[2] and substr($cmd_array[2], 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"}) )
781 $search_value = substr($cmd_array[1], 1); # cut value_search_char
782 $search_value = substr($cmd_array[2], 1) if ( $array_count > 2); # cut value_search_char
785 iset_create_filter
($args);
787 my $ptrbuf = weechat
::buffer_search
($LANG, $PRGNAME);
791 iset_get_options
($search_value);
793 weechat
::buffer_set
(weechat
::buffer_search
($LANG, $PRGNAME), "display", "1");
794 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
795 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
796 return weechat
::WEECHAT_RC_OK
;
800 iset_get_options
($search_value);
802 weechat
::buffer_set
($ptrbuf, "display", "1");
805 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
806 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
808 if ($iset_buffer eq "")
811 iset_get_options
("");
816 # iset_get_options($search_value);
817 iset_full_refresh
() if ($filter_set);
822 weechat
::buffer_set
($iset_buffer, "display", "1");
826 if ($args eq "**refresh")
832 if ($current_line > 0)
835 iset_refresh_line
($current_line + 1);
836 iset_refresh_line
($current_line);
837 iset_check_line_outside_window
();
840 if ($args eq "**down")
842 if ($current_line < $#options_names)
845 iset_refresh_line
($current_line - 1);
846 iset_refresh_line
($current_line);
847 iset_check_line_outside_window
();
850 if ($args eq "**left" && $wee_version_number >= 0x00030600)
852 weechat
::command
($iset_buffer, "/window scroll_horiz ".iset_get_window_number
()."-".weechat
::config_integer
($options_iset{"scroll_horiz"})."%");
854 if ($args eq "**right" && $wee_version_number >= 0x00030600)
856 weechat
::command
($iset_buffer, "/window scroll_horiz ".iset_get_window_number
().weechat
::config_integer
($options_iset{"scroll_horiz"})."%");
858 if ($args eq "**scroll_top")
860 my $old_current_line = $current_line;
862 iset_refresh_line
($old_current_line);
863 iset_refresh_line
($current_line);
865 weechat
::command
($iset_buffer, "/window scroll_top ".iset_get_window_number
());
867 if ($args eq "**scroll_bottom")
869 my $old_current_line = $current_line;
870 $current_line = $#options_names;
871 iset_refresh_line
($old_current_line);
872 iset_refresh_line
($current_line);
874 weechat
::command
($iset_buffer, "/window scroll_bottom ".iset_get_window_number
());
876 if ($args eq "**toggle")
878 if ($options_types[$current_line] eq "boolean")
880 iset_set_option
($options_names[$current_line], "toggle");
883 if ($args eq "**incr")
885 if (($options_types[$current_line] eq "integer")
886 || ($options_types[$current_line] eq "color"))
888 iset_set_option
($options_names[$current_line], "++1");
891 if ($args eq "**decr")
893 if (($options_types[$current_line] eq "integer")
894 || ($options_types[$current_line] eq "color"))
896 iset_set_option
($options_names[$current_line], "--1");
899 if ($args eq "**reset")
901 iset_reset_option
($options_names[$current_line]);
903 if ($args eq "**unset")
905 iset_unset_option
($options_names[$current_line]);
907 if ($args eq "**toggle_help")
909 if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1)
911 weechat
::config_option_set
($options_iset{"show_help_bar"},0,1);
916 weechat
::config_option_set
($options_iset{"show_help_bar"},1,1);
920 if ($args eq "**toggle_show_plugin_desc")
922 if (weechat
::config_boolean
($options_iset{"show_plugin_description"}) == 1)
924 weechat
::config_option_set
($options_iset{"show_plugin_description"},0,1);
926 iset_check_line_outside_window
();
931 weechat
::config_option_set
($options_iset{"show_plugin_description"},1,1);
933 iset_check_line_outside_window
();
937 if ($args eq "**set")
940 my $value = $options_values[$current_line];
941 if ($options_is_null[$current_line])
947 $quote = "\"" if ($options_types[$current_line] eq "string");
949 weechat
::buffer_set
($iset_buffer, "input", "/set ".$options_names[$current_line]." ".$quote.$value.$quote);
950 weechat
::command
($iset_buffer, "/input move_beginning_of_line");
951 weechat
::command
($iset_buffer, "/input move_next_word");
952 weechat
::command
($iset_buffer, "/input move_next_word");
953 weechat
::command
($iset_buffer, "/input move_next_char");
954 weechat
::command
($iset_buffer, "/input move_next_char") if ($quote ne "");
957 weechat
::bar_item_update
("isetbar_help") if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1);
958 return weechat
::WEECHAT_RC_OK
;
963 my ($redraw) = ($_[0]);
965 return '' if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 0);
967 if (not defined $options_names[$current_line])
969 return "No option selected. Set a new filter using command line (use '*' to see all options)";
971 if ($options_name_copy eq $options_names[$current_line] and not defined $redraw)
975 $options_name_copy = $options_names[$current_line];
977 $optionlist = weechat
::infolist_get
("option", "", $options_names[$current_line]);
978 weechat
::infolist_next
($optionlist);
979 my $full_name = weechat
::infolist_string
($optionlist,"full_name");
980 my $option_desc = "";
981 my $option_default_value = "";
982 my $option_range = "";
983 my $possible_values = "";
984 my $re = qq(\Q$full_name);
985 if (grep (/^$re$/,$options_names[$current_line]))
987 $option_desc = weechat
::infolist_string
($optionlist, "description_nls");
988 $option_desc = weechat
::infolist_string
($optionlist, "description") if ($option_desc eq "");
989 $option_desc = "No help found" if ($option_desc eq "");
990 $option_default_value = weechat
::infolist_string
($optionlist, "default_value");
991 $possible_values = weechat
::infolist_string
($optionlist, "string_values") if (weechat
::infolist_string
($optionlist, "string_values") ne "");
992 if ((weechat
::infolist_string
($optionlist, "type") eq "integer") && ($possible_values eq ""))
994 $option_range = weechat
::infolist_integer
($optionlist, "min")
995 ." .. ".weechat
::infolist_integer
($optionlist, "max");
998 weechat
::infolist_free
($optionlist);
1001 $description = weechat
::color
(weechat
::config_color
($options_iset{"color_help_option_name"})).$options_names[$current_line]
1002 .weechat
::color
("bar_fg").": "
1003 .weechat
::color
(weechat
::config_color
($options_iset{"color_help_text"})).$option_desc;
1005 # show additional infos like default value and possible values
1007 if (weechat
::config_boolean
($options_iset{"show_help_extra_info"}) == 1)
1010 weechat
::color
("bar_delim")." ["
1011 .weechat
::color
("bar_fg")."default: "
1012 .weechat
::color
("bar_delim")."\""
1013 .weechat
::color
(weechat
::config_color
($options_iset{"color_help_default_value"})).$option_default_value
1014 .weechat
::color
("bar_delim")."\"";
1015 if ($option_range ne "")
1017 $description .= weechat
::color
("bar_fg").", values: ".$option_range;
1019 if ($possible_values ne "")
1021 $possible_values =~ s/\|/", "/g; # replace '|' to '", "'
1022 $description .= weechat
::color
("bar_fg").", values: ". "\"" . $possible_values . "\"";
1025 $description .= weechat
::color
("bar_delim")."]";
1027 return $description;
1030 sub iset_check_condition_isetbar_cb
1032 my ($data, $modifier, $modifier_data, $string) = ($_[0], $_[1], $_[2], $_[3]);
1033 my $buffer = weechat
::window_get_pointer
($modifier_data, "buffer");
1036 if ((weechat
::buffer_get_string
($buffer, "plugin") eq $LANG)
1037 && (weechat
::buffer_get_string
($buffer, "name") eq $PRGNAME))
1048 my $barhidden = weechat
::config_get
("weechat.bar.isetbar.hidden");
1053 if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1)
1055 if (weechat
::config_boolean
($barhidden))
1057 weechat
::config_option_set
($barhidden, 0, 1);
1063 if (!weechat
::config_boolean
($barhidden))
1065 weechat
::config_option_set
($barhidden, 1, 1);
1071 sub iset_signal_buffer_switch_cb
1073 my $buffer_pointer = $_[2];
1075 $show_bar = 1 if (weechat
::buffer_get_integer
($iset_buffer, "num_displayed") > 0);
1076 iset_show_bar
($show_bar);
1077 iset_check_line_outside_window
() if ($buffer_pointer eq $iset_buffer);
1078 return weechat
::WEECHAT_RC_OK
;
1083 return iset_get_help
();
1086 sub iset_upgrade_ended
1088 iset_full_refresh
();
1093 # when script is unloaded, we hide bar
1097 # -------------------------------[ mouse support ]-------------------------------------
1099 sub hook_focus_iset_cb
1101 my %info = %{$_[1]};
1102 my $bar_item_line = int($info{"_bar_item_line"});
1104 if (($info{"_buffer_name"} eq $PRGNAME) && $info{"_buffer_plugin"} eq $LANG && ($bar_item_line >= 0) && ($bar_item_line <= $#iset_focus))
1106 $hash = $iset_focus[$bar_item_line];
1111 my $hash_focus = $iset_focus[0];
1112 foreach my $key (keys %$hash_focus)
1114 $hash->{$key} = "?";
1120 # _chat_line_y contains selected line
1121 sub iset_hsignal_mouse_cb
1123 my ($data, $signal, %hash) = ($_[0], $_[1], %{$_[2]});
1125 if ($hash{"_buffer_name"} eq $PRGNAME && ($hash{"_buffer_plugin"} eq $LANG))
1127 if ($hash{"_key"} eq "button1")
1129 iset_set_current_line
($hash{"_chat_line_y"});
1131 elsif ($hash{"_key"} eq "button2")
1133 if ($options_types[$hash{"_chat_line_y"}] eq "boolean")
1135 iset_set_option
($options_names[$hash{"_chat_line_y"}], "toggle");
1136 iset_set_current_line
($hash{"_chat_line_y"});
1138 elsif ($options_types[$hash{"_chat_line_y"}] eq "string")
1140 iset_set_current_line
($hash{"_chat_line_y"});
1141 weechat
::command
("", "/$PRGNAME **set");
1144 elsif ($hash{"_key"} eq "button2-gesture-left" or $hash{"_key"} eq "button2-gesture-left-long")
1146 if ($options_types[$hash{"_chat_line_y"}] eq "integer" or ($options_types[$hash{"_chat_line_y"}] eq "color"))
1148 iset_set_current_line
($hash{"_chat_line_y"});
1149 my $distance = distance
($hash{"_chat_line_x"},$hash{"_chat_line_x2"});
1150 weechat
::command
("", "/repeat $distance /$PRGNAME **decr");
1153 elsif ($hash{"_key"} eq "button2-gesture-right" or $hash{"_key"} eq "button2-gesture-right-long")
1155 if ($options_types[$hash{"_chat_line_y"}] eq "integer" or ($options_types[$hash{"_chat_line_y"}] eq "color"))
1157 iset_set_current_line
($hash{"_chat_line_y"});
1158 my $distance = distance
($hash{"_chat_line_x"},$hash{"_chat_line_x2"});
1159 weechat
::command
("", "/repeat $distance /$PRGNAME **incr");
1168 my $current_window = weechat
::current_window
();
1169 my $dest_window = weechat
::window_search_with_buffer
(weechat
::buffer_search
("perl","iset"));
1170 return 0 if ($dest_window eq "" or $current_window eq $dest_window);
1172 my $infolist = weechat
::infolist_get
("window", $dest_window, "");
1173 weechat
::infolist_next
($infolist);
1174 my $number = weechat
::infolist_integer
($infolist, "number");
1175 weechat
::infolist_free
($infolist);
1176 weechat
::command
("","/window " . $number);
1181 my ($x1,$x2) = ($_[0], $_[1]);
1183 $distance = $x1 - $x2;
1184 $distance = abs($distance);
1188 $distance = $distance / 3;
1189 $distance = 1 if ($distance == 0);
1191 elsif ($distance == 0)
1198 # -----------------------------------[ config ]---------------------------------------
1200 sub iset_config_init
1202 $iset_config_file = weechat
::config_new
($ISET_CONFIG_FILE_NAME,"iset_config_reload_cb","");
1203 return if ($iset_config_file eq "");
1206 my $section_color = weechat
::config_new_section
($iset_config_file,"color", 0, 0, "", "", "", "", "", "", "", "", "", "");
1207 if ($section_color eq "")
1209 weechat
::config_free
($iset_config_file);
1212 $options_iset{"color_option"} = weechat
::config_new_option
(
1213 $iset_config_file, $section_color,
1214 "option", "color", "Color for option name in iset buffer", "", 0, 0,
1215 "default", "default", 0, "", "", "full_refresh_cb", "", "", "");
1216 $options_iset{"color_option_selected"} = weechat
::config_new_option
(
1217 $iset_config_file, $section_color,
1218 "option_selected", "color", "Color for selected option name in iset buffer", "", 0, 0,
1219 "white", "white", 0, "", "", "full_refresh_cb", "", "", "");
1220 $options_iset{"color_type"} = weechat
::config_new_option
(
1221 $iset_config_file, $section_color,
1222 "type", "color", "Color for option type (integer, boolean, string)", "", 0, 0,
1223 "brown", "brown", 0, "", "", "full_refresh_cb", "", "", "");
1224 $options_iset{"color_type_selected"} = weechat
::config_new_option
(
1225 $iset_config_file, $section_color,
1226 "type_selected", "color", "Color for selected option type (integer, boolean, string)", "", 0, 0,
1227 "yellow", "yellow", 0, "", "", "full_refresh_cb", "", "", "");
1228 $options_iset{"color_value"} = weechat
::config_new_option
(
1229 $iset_config_file, $section_color,
1230 "value", "color", "Color for option value", "", 0, 0,
1231 "cyan", "cyan", 0, "", "", "full_refresh_cb", "", "", "");
1232 $options_iset{"color_value_selected"} = weechat
::config_new_option
(
1233 $iset_config_file, $section_color,
1234 "value_selected", "color", "Color for selected option value", "", 0, 0,
1235 "lightcyan", "lightcyan", 0, "", "", "full_refresh_cb", "", "", "");
1236 $options_iset{"color_value_undef"} = weechat
::config_new_option
(
1237 $iset_config_file, $section_color,
1238 "value_undef", "color", "Color for option value undef", "", 0, 0,
1239 "green", "green", 0, "", "", "full_refresh_cb", "", "", "");
1240 $options_iset{"color_value_undef_selected"} = weechat
::config_new_option
(
1241 $iset_config_file, $section_color,
1242 "value_undef_selected", "color", "Color for selected option value undef", "", 0, 0,
1243 "lightgreen", "lightgreen", 0, "", "", "full_refresh_cb", "", "", "");
1244 $options_iset{"color_bg_selected"} = weechat
::config_new_option
(
1245 $iset_config_file, $section_color,
1246 "bg_selected", "color", "Background color for current selected option", "", 0, 0,
1247 "red", "red", 0, "", "", "full_refresh_cb", "", "", "");
1248 $options_iset{"color_help_option_name"} = weechat
::config_new_option
(
1249 $iset_config_file, $section_color,
1250 "help_option_name", "color", "Color for option name in help-bar", "", 0, 0,
1251 "white", "white", 0, "", "", "bar_refresh", "", "", "");
1252 $options_iset{"color_help_text"} = weechat
::config_new_option
(
1253 $iset_config_file, $section_color,
1254 "help_text", "color", "Color for option description in help-bar", "", 0, 0,
1255 "default", "default", 0, "", "", "bar_refresh", "", "", "");
1256 $options_iset{"color_help_default_value"} = weechat
::config_new_option
(
1257 $iset_config_file, $section_color,
1258 "help_default_value", "color", "Color for default option value in help-bar", "", 0, 0,
1259 "green", "green", 0, "", "", "bar_refresh", "", "", "");
1262 my $section_help = weechat
::config_new_section
($iset_config_file,"help", 0, 0, "", "", "", "", "", "", "", "", "", "");
1263 if ($section_help eq "")
1265 weechat
::config_free
($iset_config_file);
1268 $options_iset{"show_help_bar"} = weechat
::config_new_option
(
1269 $iset_config_file, $section_help,
1270 "show_help_bar", "boolean", "Show help bar", "", 0, 0,
1271 "on", "on", 0, "", "", "toggle_help_cb", "", "", "");
1272 $options_iset{"show_help_extra_info"} = weechat
::config_new_option
(
1273 $iset_config_file, $section_help,
1274 "show_help_extra_info", "boolean", "Show additional information in help bar (default value, max./min. value) ", "", 0, 0,
1275 "on", "on", 0, "", "", "", "", "", "");
1276 $options_iset{"show_plugin_description"} = weechat
::config_new_option
(
1277 $iset_config_file, $section_help,
1278 "show_plugin_description", "boolean", "Show plugin description in iset buffer", "", 0, 0,
1279 "off", "off", 0, "", "", "full_refresh_cb", "", "", "");
1282 my $section_look = weechat
::config_new_section
($iset_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "");
1283 if ($section_look eq "")
1285 weechat
::config_free
($iset_config_file);
1288 $options_iset{"value_search_char"} = weechat
::config_new_option
(
1289 $iset_config_file, $section_look,
1290 "value_search_char", "string", "Trigger char to tell iset to search for value instead of option (for example: =red)", "", 0, 0,
1291 "=", "=", 0, "", "", "", "", "", "");
1292 $options_iset{"scroll_horiz"} = weechat
::config_new_option
(
1293 $iset_config_file, $section_look,
1294 "scroll_horiz", "integer", "scroll content of iset buffer n%", "", 1, 100,
1295 "10", "10", 0, "", "", "", "", "", "");
1296 $options_iset{"show_current_line"} = weechat
::config_new_option
(
1297 $iset_config_file, $section_look,
1298 "show_current_line", "boolean", "show current line in title bar.", "", 0, 0,
1299 "on", "on", 0, "", "", "", "", "", "");
1302 sub iset_config_reload_cb
1304 my ($data,$config_file) = ($_[0], $_[1]);
1305 return weechat
::config_reload
($config_file)
1308 sub iset_config_read
1310 return weechat
::config_read
($iset_config_file) if ($iset_config_file ne "");
1313 sub iset_config_write
1315 return weechat
::config_write
($iset_config_file) if ($iset_config_file ne "");
1320 iset_full_refresh
();
1321 return weechat
::WEECHAT_RC_OK
;
1327 weechat
::bar_item_update
("isetbar_help") if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1);
1328 return weechat
::WEECHAT_RC_OK
;
1333 my $value = weechat
::config_boolean
($options_iset{"show_help_bar"});
1334 iset_show_bar
($value);
1335 return weechat
::WEECHAT_RC_OK
;
1338 # -----------------------------------[ main ]-----------------------------------------
1340 weechat
::register
($PRGNAME, $AUTHOR, $VERSION, $LICENSE,
1341 $DESCR, "iset_end", "");
1343 $wee_version_number = weechat
::info_get
("version_number", "") || 0;
1348 weechat
::hook_command
($PRGNAME, "Interactive set", "f <file> || s <section> || [=][=]<text>",
1349 "f file : show options for a file\n".
1350 "s section: show options for a section\n".
1351 "text : show options with 'text' in name\n".
1352 weechat
::config_string
($options_iset{"value_search_char"})."text : show options with 'text' in value\n".
1353 weechat
::config_string
($options_iset{"value_search_char"}).weechat
::config_string
($options_iset{"value_search_char"})."text : show options with exact 'text' in value\n\n".
1354 "Keys for iset buffer:\n".
1355 "f11,f12 : move iset content left/right\n".
1356 "up,down : move one option up/down\n".
1357 "pgup,pdwn : move one page up/down\n".
1358 "home,end : move to first/last option\n".
1359 "ctrl+'L' : refresh options and screen\n".
1360 "alt+space : toggle boolean on/off\n".
1361 "alt+'+' : increase value (for integer or color)\n".
1362 "alt+'-' : decrease value (for integer or color)\n".
1363 "alt+'i',alt+'r': reset value of option\n".
1364 "alt+'i',alt+'u': unset option\n".
1365 "alt+enter : set new value for option (edit it with command line)\n".
1366 "text,enter : set a new filter using command line (use '*' to see all options)\n".
1367 "alt+'v' : toggle help bar on/off\n".
1368 "alt+'p' : toggle option \"show_plugin_description\" on/off\n".
1371 "wheel up/down : move cursor up/down\n".
1372 "left button : select an option from list\n".
1373 "right button : toggle boolean (on/off) or set a new value for option (edit it with command line)\n".
1374 "right button + drag left/right: increase/decrease value (for integer or color)\n".
1377 " show options for file 'weechat'\n".
1378 " /iset f weechat\n".
1379 " show options for file 'irc'\n".
1381 " show options for section 'look'\n".
1383 " show all options with text 'nicklist' in name\n".
1384 " /iset nicklist\n".
1385 " show all values which contain 'red'. ('" . weechat
::config_string
($options_iset{"value_search_char"}) . "' is a trigger char).\n".
1386 " /iset ". weechat
::config_string
($options_iset{"value_search_char"}) ."red\n".
1387 " show all values which hit 'off'. ('" . weechat
::config_string
($options_iset{"value_search_char"}) . weechat
::config_string
($options_iset{"value_search_char"}) . "' is a trigger char).\n".
1388 " /iset ". weechat
::config_string
($options_iset{"value_search_char"}) . weechat
::config_string
($options_iset{"value_search_char"}) ."off\n".
1389 " show options for file 'weechat' which contains value 'off'\n".
1390 " /iset f weechat ".weechat
::config_string
($options_iset{"value_search_char"})."off\n".
1392 "", "iset_cmd_cb", "");
1393 weechat
::hook_signal
("upgrade_ended", "iset_upgrade_ended", "");
1394 weechat
::hook_signal
("window_scrolled", "iset_signal_window_scrolled_cb", "");
1395 weechat
::hook_signal
("buffer_switch", "iset_signal_buffer_switch_cb","");
1396 weechat
::bar_item_new
("isetbar_help", "iset_item_cb", "");
1397 weechat
::bar_new
("isetbar", "on", "0", "window", "", "top", "horizontal",
1398 "vertical", "3", "3", "default", "cyan", "default", "1",
1400 weechat
::hook_modifier
("bar_condition_isetbar", "iset_check_condition_isetbar_cb", "");
1401 weechat
::hook_config
("*", "iset_config_cb", "");
1402 $iset_buffer = weechat
::buffer_search
($LANG, $PRGNAME);
1403 iset_init
() if ($iset_buffer ne "");
1405 if ($wee_version_number >= 0x00030600)
1407 weechat
::hook_focus
("chat", "hook_focus_iset_cb", "");
1408 weechat
::hook_hsignal
($PRGNAME."_mouse", "iset_hsignal_mouse_cb", "");
1409 weechat
::key_bind
("mouse", \
%mouse_keys);