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 # 2013-08-03, Sebastien Helleu <flashcode@flashtux.org>:
23 # version 3.2: allow "q" as input in iset buffer to close it
24 # 2013-07-14, Sebastien Helleu <flashcode@flashtux.org>:
25 # version 3.1: remove unneeded calls to iset_refresh() in mouse callback
26 # (faster mouse actions when lot of options are displayed),
27 # fix bug when clicking on a line after the last option displayed
28 # 2013-04-30, arza <arza@arza.us>:
29 # version 3.0: simpler title, fix refresh on unset
30 # 2012-12-16, nils_2 <weechatter@arcor.de>:
31 # version 2.9: fix focus window with iset buffer on mouse click
32 # 2012-08-25, nils_2 <weechatter@arcor.de>:
33 # version 2.8: most important key and mouse bindings for iset buffer added to title-bar (idea The-Compiler)
34 # 2012-07-31, nils_2 <weechatter@arcor.de>:
35 # version 2.7: add combined option and value search (see /help iset)
36 # : add exact value search (see /help iset)
37 # : fix problem with metacharacter in value search
38 # : fix use of uninitialized value for unset option and reset value of option
39 # 2012-07-25, nils_2 <weechatter@arcor.de>:
40 # version 2.6: switch to iset buffer (if existing) when command /iset is called with arguments
41 # 2012-03-17, Sebastien Helleu <flashcode@flashtux.org>:
42 # version 2.5: fix check of sections when creating config file
43 # 2012-03-09, Sebastien Helleu <flashcode@flashtux.org>:
44 # version 2.4: fix reload of config file
45 # 2012-02-02, nils_2 <weechatter@arcor.de>:
46 # version 2.3: fixed: refresh problem with new search results and cursor was outside window.
47 # : add: new option "current_line" in title bar
48 # version 2.2: fixed: refresh error when toggling plugins description
49 # 2011-11-05, nils_2 <weechatter@arcor.de>:
50 # version 2.1: use own config file (iset.conf), fix own help color (used immediately)
51 # 2011-10-16, nils_2 <weechatter@arcor.de>:
52 # version 2.0: add support for left-mouse-button and more sensitive mouse gesture (for integer/color options)
53 # add help text for mouse support
54 # 2011-09-20, Sebastien Helleu <flashcode@flashtux.org>:
55 # version 1.9: add mouse support, fix iset buffer, fix errors on first load under FreeBSD
56 # 2011-07-21, nils_2 <weechatter@arcor.de>:
57 # version 1.8: added: option "show_plugin_description" (alt+p)
58 # fixed: typos in /help iset (lower case for alt+'x' keys)
59 # 2011-05-29, nils_2 <weechatter@arcor.de>:
60 # version 1.7: added: version check for future needs
61 # added: new option (scroll_horiz) and usage of scroll_horiz function (weechat >= 0.3.6 required)
62 # fixed: help_bar did not pop up immediately using key-shortcut
63 # 2011-02-19, nils_2 <weechatter@arcor.de>:
64 # version 1.6: added: display of all possible values in help bar (show_help_extra_info)
65 # fixed: external user options never loaded when starting iset first time
66 # 2011-02-13, Sebastien Helleu <flashcode@flashtux.org>:
67 # version 1.5: use new help format for command arguments
68 # 2011-02-03, nils_2 <weechatter@arcor.de>:
69 # version 1.4: fixed: restore value filter after /upgrade using buffer local variable.
70 # 2011-01-14, nils_2 <weechatter@arcor.de>:
71 # version 1.3: added function to search for values (option value_search_char).
73 # 2010-12-26, Sebastien Helleu <flashcode@flashtux.org>:
74 # version 1.2: improve speed of /upgrade when iset buffer is open,
75 # restore filter used after /upgrade using buffer local variable,
76 # use /iset filter argument if buffer is open.
77 # 2010-11-21, drubin <drubin+weechat@smartcube.co.za>:
78 # version 1.1.1: fix bugs with cursor position
79 # 2010-11-20, nils_2 <weechatter@arcor.de>:
80 # version 1.1: cursor position set to value
81 # 2010-08-03, Sebastien Helleu <flashcode@flashtux.org>:
82 # version 1.0: move misplaced call to infolist_free()
83 # 2010-02-02, rettub <rettub@gmx.net>:
84 # version 0.9: turn all the help stuff off if option 'show_help_bar' is 'off',
85 # new key binding <alt>-<v> to toggle help_bar and help stuff on/off
86 # 2010-01-30, nils_2 <weechatter@arcor.de>:
87 # version 0.8: fix error when option does not exist
88 # 2010-01-24, Sebastien Helleu <flashcode@flashtux.org>:
89 # version 0.7: display iset bar only on iset buffer
90 # 2010-01-22, nils_2 <weechatter@arcor.de> and drubin:
91 # version 0.6: add description in a bar, fix singular/plural bug in title bar,
92 # fix selected line when switching buffer
93 # 2009-06-21, Sebastien Helleu <flashcode@flashtux.org>:
94 # version 0.5: fix bug with iset buffer after /upgrade
95 # 2009-05-02, Sebastien Helleu <flashcode@flashtux.org>:
96 # version 0.4: sync with last API changes
97 # 2009-01-04, Sebastien Helleu <flashcode@flashtux.org>:
98 # version 0.3: open iset buffer when /iset command is executed
99 # 2009-01-04, Sebastien Helleu <flashcode@flashtux.org>:
100 # version 0.2: use null values for options, add colors, fix refresh bugs,
101 # use new keys to reset/unset options, sort options by name,
102 # display number of options in buffer's title
103 # 2008-11-05, Sebastien Helleu <flashcode@flashtux.org>:
104 # version 0.1: first official version
105 # 2008-04-19, Sebastien Helleu <flashcode@flashtux.org>:
110 my $PRGNAME = "iset";
112 my $DESCR = "Interactive Set for configuration options";
113 my $AUTHOR = "Sebastien Helleu <flashcode\@flashtux.org>";
114 my $LICENSE = "GPL3";
116 my $ISET_CONFIG_FILE_NAME = "iset";
118 my $iset_config_file;
119 my $iset_buffer = "";
120 my $wee_version_number = 0;
122 my @options_names = ();
123 my @options_types = ();
124 my @options_values = ();
125 my @options_is_null = ();
126 my $option_max_length = 0;
127 my $current_line = 0;
129 my $description = "";
130 my $options_name_copy = "";
131 my $iset_filter_title = "";
132 # search modes: 0 = index() on value, 1 = grep() on value, 2 = grep() on option, 3 = grep on option & value
134 my $search_value = "";
135 my $help_text_keys = "alt + space: toggle, +/-: increase/decrease, enter: change, ir: reset, iu: unset, v: toggle help bar";
136 my $help_text_mouse = "Mouse: left: select, right: toggle/set, right + drag left/right: increase/decrease";
139 my %mouse_keys = ("\@chat(perl.$PRGNAME):button1" => "hsignal:iset_mouse",
140 "\@chat(perl.$PRGNAME):button2*" => "hsignal:iset_mouse",
141 "\@chat(perl.$PRGNAME):wheelup" => "/repeat 5 /iset **up",
142 "\@chat(perl.$PRGNAME):wheeldown" => "/repeat 5 /iset **down");
147 if ($iset_buffer ne "")
149 my $current_line_counter = "";
150 $current_line_counter = ($current_line + 1) . "/" if (weechat
::config_boolean
($options_iset{"show_current_line"}) == 1);
151 my $show_filter = "";
152 if ($search_mode eq 0)
154 $iset_filter_title = "(value) ";
155 $show_filter = $search_value;
156 if ( substr($show_filter,0,1) eq weechat
::config_string
($options_iset{"value_search_char"}) )
158 $show_filter = substr($show_filter,1,length($show_filter));
161 elsif ($search_mode eq 1)
163 $iset_filter_title = "(value) ";
164 $show_filter = "*".$search_value."*";
166 elsif ($search_mode eq 2)
168 $iset_filter_title = "";
169 $filter = "*" if ($filter eq "");
170 $show_filter = $filter;
172 elsif ($search_mode eq 3)
174 $iset_filter_title = "(option) ";
175 $show_filter = $filter
176 .weechat
::color
("default")
178 .weechat
::color
("yellow")
179 ."*".$search_value."*";
181 weechat
::buffer_set
($iset_buffer, "title",
183 .weechat
::color
("yellow")
185 .weechat
::color
("default")." | "
186 .$current_line_counter
195 sub iset_create_filter
198 if ( $search_mode == 3 )
200 my @cmd_array = split(/ /,$filter);
201 my $array_count = @cmd_array;
202 $filter = $cmd_array[0];
203 $filter = $cmd_array[0] . " " . $cmd_array[1] if ( $array_count >2 );
205 $filter = "$1.*" if ($filter =~ /f (.*)/); # search file
206 $filter = "*.$1.*" if ($filter =~ /s (.*)/); # search section
207 if ((substr($filter, 0, 1) ne "*") && (substr($filter, -1, 1) ne "*"))
209 $filter = "*".$filter."*";
211 if ($iset_buffer ne "")
213 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_filter", $filter);
217 sub iset_buffer_input
219 my ($data, $buffer, $string) = ($_[0], $_[1], $_[2]);
222 weechat
::buffer_close
($buffer);
223 return weechat
::WEECHAT_RC_OK
;
226 my @cmd_array = split(/ /,$string);
227 my $array_count = @cmd_array;
228 my $string2 = substr($string, 0, 1);
229 if ($string2 eq weechat
::config_string
($options_iset{"value_search_char"})
230 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"})) )
233 $search_value = substr($string, 1);
234 iset_get_values
($search_value);
235 if ($iset_buffer ne "")
237 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
243 if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s")
245 if ( defined $cmd_array[1] and substr($cmd_array[1], 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"})
246 or defined $cmd_array[2] and substr($cmd_array[2], 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"}) )
249 $search_value = substr($cmd_array[1], 1); # cut value_search_char
250 $search_value = substr($cmd_array[2], 1) if ( $array_count > 2); # cut value_search_char
253 if ( $search_mode == 3)
255 iset_create_filter
($string);
256 iset_get_options
($search_value);
259 iset_create_filter
($string);
260 iset_get_options
("");
263 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
264 weechat
::buffer_clear
($buffer);
267 return weechat
::WEECHAT_RC_OK
;
270 sub iset_buffer_close
274 return weechat
::WEECHAT_RC_OK
;
280 $iset_buffer = weechat
::buffer_search
($LANG, $PRGNAME);
281 if ($iset_buffer eq "")
283 $iset_buffer = weechat
::buffer_new
($PRGNAME, "iset_buffer_input", "", "iset_buffer_close", "");
287 my $new_filter = weechat
::buffer_get_string
($iset_buffer, "localvar_iset_filter");
288 $search_mode = weechat
::buffer_get_string
($iset_buffer, "localvar_iset_search_mode");
289 $search_value = weechat
::buffer_get_string
($iset_buffer, "localvar_iset_search_value");
290 $filter = $new_filter if ($new_filter ne "");
292 if ($iset_buffer ne "")
294 weechat
::buffer_set
($iset_buffer, "type", "free");
296 weechat
::buffer_set
($iset_buffer, "key_bind_ctrl-L", "/iset **refresh");
297 weechat
::buffer_set
($iset_buffer, "key_bind_meta2-A", "/iset **up");
298 weechat
::buffer_set
($iset_buffer, "key_bind_meta2-B", "/iset **down");
299 weechat
::buffer_set
($iset_buffer, "key_bind_meta2-23~", "/iset **left");
300 weechat
::buffer_set
($iset_buffer, "key_bind_meta2-24~" , "/iset **right");
301 weechat
::buffer_set
($iset_buffer, "key_bind_meta- ", "/iset **toggle");
302 weechat
::buffer_set
($iset_buffer, "key_bind_meta-+", "/iset **incr");
303 weechat
::buffer_set
($iset_buffer, "key_bind_meta--", "/iset **decr");
304 weechat
::buffer_set
($iset_buffer, "key_bind_meta-imeta-r", "/iset **reset");
305 weechat
::buffer_set
($iset_buffer, "key_bind_meta-imeta-u", "/iset **unset");
306 weechat
::buffer_set
($iset_buffer, "key_bind_meta-ctrl-J", "/iset **set");
307 weechat
::buffer_set
($iset_buffer, "key_bind_meta-ctrl-M", "/iset **set");
308 weechat
::buffer_set
($iset_buffer, "key_bind_meta-meta2-1~", "/iset **scroll_top");
309 weechat
::buffer_set
($iset_buffer, "key_bind_meta-meta2-4~", "/iset **scroll_bottom");
310 weechat
::buffer_set
($iset_buffer, "key_bind_meta-v", "/iset **toggle_help");
311 weechat
::buffer_set
($iset_buffer, "key_bind_meta-p", "/iset **toggle_show_plugin_desc");
312 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_filter", $filter);
313 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
314 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
320 my $var_value = $_[0];
321 $var_value = "" if (not defined $var_value);
322 $var_value = lc($var_value);
323 $search_value = $var_value;
327 @options_values = ();
328 @options_is_null = ();
329 $option_max_length = 0;
330 my %options_internal = ();
336 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $var_value) if ($search_mode == 3);
338 my $infolist = weechat
::infolist_get
("option", "", $filter);
339 while (weechat
::infolist_next
($infolist))
341 $key = sprintf("%08d", $i);
342 my $name = weechat
::infolist_string
($infolist, "full_name");
343 next if (weechat
::config_boolean
($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1);
344 my $type = weechat
::infolist_string
($infolist, "type");
345 my $value = weechat
::infolist_string
($infolist, "value");
346 my $is_null = weechat
::infolist_integer
($infolist, "value_is_null");
347 if ($search_mode == 3)
349 my $value = weechat
::infolist_string
($infolist, "value");
350 if ( grep /\Q$var_value/,lc($value) )
352 $options_internal{$name}{"type"} = $type;
353 $options_internal{$name}{"value"} = $value;
354 $options_internal{$name}{"is_null"} = $is_null;
355 $option_max_length = length($name) if (length($name) > $option_max_length);
356 $iset_struct{$key} = $options_internal{$name};
357 push(@iset_focus, $iset_struct{$key});
362 $options_internal{$name}{"type"} = $type;
363 $options_internal{$name}{"value"} = $value;
364 $options_internal{$name}{"is_null"} = $is_null;
365 $option_max_length = length($name) if (length($name) > $option_max_length);
366 $iset_struct{$key} = $options_internal{$name};
367 push(@iset_focus, $iset_struct{$key});
371 weechat
::infolist_free
($infolist);
373 foreach my $name (sort keys %options_internal)
375 push(@options_names, $name);
376 push(@options_types, $options_internal{$name}{"type"});
377 push(@options_values, $options_internal{$name}{"value"});
378 push(@options_is_null, $options_internal{$name}{"is_null"});
384 my $var_value = $_[0];
385 $var_value = lc($var_value);
386 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"}))
388 $var_value = substr($var_value,1,length($var_value));
391 iset_search_values
($var_value,$search_mode);
392 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
393 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $var_value);
394 $search_value = $var_value;
396 sub iset_search_values
398 my ($var_value,$search_mode) = ($_[0],$_[1]);
401 @options_values = ();
402 @options_is_null = ();
403 $option_max_length = 0;
404 my %options_internal = ();
406 my $infolist = weechat
::infolist_get
("option", "", "*");
407 while (weechat
::infolist_next
($infolist))
409 my $name = weechat
::infolist_string
($infolist, "full_name");
410 next if (weechat
::config_boolean
($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1);
411 my $type = weechat
::infolist_string
($infolist, "type");
412 my $is_null = weechat
::infolist_integer
($infolist, "value_is_null");
413 my $value = weechat
::infolist_string
($infolist, "value");
416 if ( grep /\Q$var_value/,lc($value) )
418 $options_internal{$name}{"type"} = $type;
419 $options_internal{$name}{"value"} = $value;
420 $options_internal{$name}{"is_null"} = $is_null;
421 $option_max_length = length($name) if (length($name) > $option_max_length);
426 # if ($value =~ /\Q$var_value/si)
427 if (lc($value) eq $var_value)
429 $options_internal{$name}{"type"} = $type;
430 $options_internal{$name}{"value"} = $value;
431 $options_internal{$name}{"is_null"} = $is_null;
432 $option_max_length = length($name) if (length($name) > $option_max_length);
437 weechat
::infolist_free
($infolist);
438 foreach my $name (sort keys %options_internal)
440 push(@options_names, $name);
441 push(@options_types, $options_internal{$name}{"type"});
442 push(@options_values, $options_internal{$name}{"value"});
443 push(@options_is_null, $options_internal{$name}{"is_null"});
447 sub iset_refresh_line
449 if ($iset_buffer ne "")
452 if ($y <= $#options_names)
454 return if (! defined($options_types[$y]));
455 my $format = sprintf("%%s%%-%ds %%s %%-7s %%s %%s%%s%%s", $option_max_length);
457 $around = "\"" if ((!$options_is_null[$y]) && ($options_types[$y] eq "string"));
459 my $color1 = weechat
::color
(weechat
::config_color
($options_iset{"color_option"}));
460 my $color2 = weechat
::color
(weechat
::config_color
($options_iset{"color_type"}));
462 if ($options_is_null[$y])
464 $color3 = weechat
::color
(weechat
::config_color
($options_iset{"color_value_undef"}));
468 $color3 = weechat
::color
(weechat
::config_color
($options_iset{"color_value"}));
470 if ($y == $current_line)
472 $color1 = weechat
::color
(weechat
::config_color
($options_iset{"color_option_selected"}).",".weechat
::config_color
($options_iset{"color_bg_selected"}));
473 $color2 = weechat
::color
(weechat
::config_color
($options_iset{"color_type_selected"}).",".weechat
::config_color
($options_iset{"color_bg_selected"}));
474 if ($options_is_null[$y])
476 $color3 = weechat
::color
(weechat
::config_color
($options_iset{"color_value_undef_selected"}).",".weechat
::config_color
($options_iset{"color_bg_selected"}));
480 $color3 = weechat
::color
(weechat
::config_color
($options_iset{"color_value_selected"}).",".weechat
::config_color
($options_iset{"color_bg_selected"}));
483 my $value = $options_values[$y];
484 $value = "(undef)" if ($options_is_null[$y]);
485 my $strline = sprintf($format,
486 $color1, $options_names[$y],
487 $color2, $options_types[$y],
488 $color3, $around, $value, $around);
489 weechat
::print_y
($iset_buffer, $y, $strline);
497 if (($iset_buffer ne "") && ($#options_names >= 0))
499 foreach my $y (0 .. $#options_names)
501 iset_refresh_line
($y);
505 weechat
::bar_item_update
("isetbar_help") if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1);
508 sub iset_full_refresh
510 $iset_buffer = weechat
::buffer_search
($LANG, $PRGNAME);
511 if ($iset_buffer ne "")
513 weechat
::buffer_clear
($iset_buffer) unless defined $_[0]; # iset_full_refresh(1) does a full refresh without clearing buffer
514 # search for "*" in $filter.
515 if ($filter =~ m/\*/ and $search_mode == 2)
517 iset_get_options
("");
521 if ($search_mode == 0)
523 $search_value = "=" . $search_value;
524 iset_get_values
($search_value);
526 elsif ($search_mode == 1)
528 iset_get_values
($search_value);
530 elsif ($search_mode == 3)
532 iset_create_filter
($filter);
533 iset_get_options
($search_value);
536 if (weechat
::config_boolean
($options_iset{"show_plugin_description"}) == 1)
538 iset_set_current_line
($current_line);
541 $current_line = $#options_names if ($current_line > $#options_names);
544 weechat
::command
($iset_buffer, "/window refresh");
548 sub iset_set_current_line
550 my $new_current_line = $_[0];
551 if ($new_current_line >= 0)
553 my $old_current_line = $current_line;
554 $current_line = $new_current_line;
555 $current_line = $#options_names if ($current_line > $#options_names);
556 if ($old_current_line != $current_line)
558 iset_refresh_line
($old_current_line);
559 iset_refresh_line
($current_line);
560 weechat
::bar_item_update
("isetbar_help") if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1);
565 sub iset_signal_window_scrolled_cb
567 my ($data, $signal, $signal_data) = ($_[0], $_[1], $_[2]);
568 if ($iset_buffer ne "")
570 my $infolist = weechat
::infolist_get
("window", $signal_data, "");
571 if (weechat
::infolist_next
($infolist))
573 if (weechat
::infolist_pointer
($infolist, "buffer") eq $iset_buffer)
575 my $old_current_line = $current_line;
576 my $new_current_line = $current_line;
577 my $start_line_y = weechat
::infolist_integer
($infolist, "start_line_y");
578 my $chat_height = weechat
::infolist_integer
($infolist, "chat_height");
579 $new_current_line += $chat_height if ($new_current_line < $start_line_y);
580 $new_current_line -= $chat_height if ($new_current_line >= $start_line_y + $chat_height);
581 $new_current_line = $start_line_y if ($new_current_line < $start_line_y);
582 $new_current_line = $start_line_y + $chat_height - 1 if ($new_current_line >= $start_line_y + $chat_height);
583 iset_set_current_line
($new_current_line);
586 weechat
::infolist_free
($infolist);
589 return weechat
::WEECHAT_RC_OK
;
592 sub iset_get_window_number
594 if ($iset_buffer ne "")
596 my $window = weechat
::window_search_with_buffer
($iset_buffer);
597 return "-window ".weechat
::window_get_integer
($window, "number")." " if ($window ne "");
602 sub iset_check_line_outside_window
604 if ($iset_buffer ne "")
607 if ($wee_version_number >= 0x00030500)
609 my $window = weechat
::window_search_with_buffer
($iset_buffer);
610 $infolist = weechat
::infolist_get
("window", $window, "") if $window;
614 $infolist = weechat
::infolist_get
("window", "", "current");
618 if (weechat
::infolist_next
($infolist))
620 my $start_line_y = weechat
::infolist_integer
($infolist, "start_line_y");
621 my $chat_height = weechat
::infolist_integer
($infolist, "chat_height");
622 my $window_number = "";
623 if ($wee_version_number >= 0x00030500)
625 $window_number = "-window ".weechat
::infolist_integer
($infolist, "number")." ";
627 if ($start_line_y > $current_line)
629 weechat
::command
($iset_buffer, "/window scroll ".$window_number."-".($start_line_y - $current_line));
633 if ($start_line_y <= $current_line - $chat_height)
635 weechat
::command
($iset_buffer, "/window scroll ".$window_number."+".($current_line - $start_line_y - $chat_height + 1));
640 weechat
::infolist_free
($infolist);
645 sub iset_get_option_name_index
647 my $option_name = $_[0];
649 while ($index <= $#options_names)
651 return -1 if ($options_names[$index] gt $option_name);
652 return $index if ($options_names[$index] eq $option_name);
660 my ($data, $option_name, $value) = ($_[0], $_[1], $_[2]);
662 if ($iset_buffer ne "")
664 return weechat
::WEECHAT_RC_OK
if (weechat
::info_get
("weechat_upgrading", "") eq "1");
666 my $index = iset_get_option_name_index
($option_name);
669 # refresh info about changed option
670 my $infolist = weechat
::infolist_get
("option", "", $option_name);
673 weechat
::infolist_next
($infolist);
674 if (weechat
::infolist_fields
($infolist))
676 $options_types[$index] = weechat
::infolist_string
($infolist, "type");
677 $options_values[$index] = weechat
::infolist_string
($infolist, "value");
678 $options_is_null[$index] = weechat
::infolist_integer
($infolist, "value_is_null");
679 iset_refresh_line
($index);
680 iset_title
() if ($option_name eq "iset.look.show_current_line");
684 iset_full_refresh
(1); # if not found, refresh fully without clearing buffer
685 weechat
::print_y
($iset_buffer, $#options_names + 1, "");
687 weechat
::infolist_free
($infolist);
692 iset_full_refresh
() if ($option_name ne "weechat.bar.isetbar.hidden");
696 return weechat
::WEECHAT_RC_OK
;
701 my ($option, $value) = ($_[0],$_[1]);
702 if (defined $option and defined $value)
704 $option = weechat
::config_get
($option);
705 weechat
::config_option_set
($option, $value, 1) if ($option ne "");
709 sub iset_reset_option
714 $option = weechat
::config_get
($option);
715 weechat
::config_option_reset
($option, 1) if ($option ne "");
719 sub iset_unset_option
724 $option = weechat
::config_get
($option);
725 weechat
::config_option_unset
($option) if ($option ne "");
732 my ($data, $buffer, $args) = ($_[0], $_[1], $_[2]);
734 # $search_value = "";
735 if (($args ne "") && (substr($args, 0, 2) ne "**"))
737 my @cmd_array = split(/ /,$args);
738 my $array_count = @cmd_array;
739 if (substr($args, 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"})
740 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"})) )
743 my $search_value = substr($args, 1); # cut value_search_char
744 if ($iset_buffer ne "")
746 weechat
::buffer_clear
($iset_buffer);
747 weechat
::command
($iset_buffer, "/window refresh");
749 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
750 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
752 iset_get_values
($search_value);
754 weechat
::buffer_set
($iset_buffer, "display", "1");
755 # $filter = $var_value;
756 return weechat
::WEECHAT_RC_OK
;
763 if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s")
765 if ( defined $cmd_array[1] and substr($cmd_array[1], 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"})
766 or defined $cmd_array[2] and substr($cmd_array[2], 0, 1) eq weechat
::config_string
($options_iset{"value_search_char"}) )
769 $search_value = substr($cmd_array[1], 1); # cut value_search_char
770 $search_value = substr($cmd_array[2], 1) if ( $array_count > 2); # cut value_search_char
773 iset_create_filter
($args);
775 my $ptrbuf = weechat
::buffer_search
($LANG, $PRGNAME);
779 iset_get_options
($search_value);
781 weechat
::buffer_set
(weechat
::buffer_search
($LANG, $PRGNAME), "display", "1");
782 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
783 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
784 return weechat
::WEECHAT_RC_OK
;
788 iset_get_options
($search_value);
790 weechat
::buffer_set
($ptrbuf, "display", "1");
793 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_mode", $search_mode);
794 weechat
::buffer_set
($iset_buffer, "localvar_set_iset_search_value", $search_value);
796 if ($iset_buffer eq "")
799 iset_get_options
("");
804 # iset_get_options($search_value);
805 iset_full_refresh
() if ($filter_set);
810 weechat
::buffer_set
($iset_buffer, "display", "1");
814 if ($args eq "**refresh")
820 if ($current_line > 0)
823 iset_refresh_line
($current_line + 1);
824 iset_refresh_line
($current_line);
825 iset_check_line_outside_window
();
828 if ($args eq "**down")
830 if ($current_line < $#options_names)
833 iset_refresh_line
($current_line - 1);
834 iset_refresh_line
($current_line);
835 iset_check_line_outside_window
();
838 if ($args eq "**left" && $wee_version_number >= 0x00030600)
840 weechat
::command
($iset_buffer, "/window scroll_horiz ".iset_get_window_number
()."-".weechat
::config_integer
($options_iset{"scroll_horiz"})."%");
842 if ($args eq "**right" && $wee_version_number >= 0x00030600)
844 weechat
::command
($iset_buffer, "/window scroll_horiz ".iset_get_window_number
().weechat
::config_integer
($options_iset{"scroll_horiz"})."%");
846 if ($args eq "**scroll_top")
848 my $old_current_line = $current_line;
850 iset_refresh_line
($old_current_line);
851 iset_refresh_line
($current_line);
853 weechat
::command
($iset_buffer, "/window scroll_top ".iset_get_window_number
());
855 if ($args eq "**scroll_bottom")
857 my $old_current_line = $current_line;
858 $current_line = $#options_names;
859 iset_refresh_line
($old_current_line);
860 iset_refresh_line
($current_line);
862 weechat
::command
($iset_buffer, "/window scroll_bottom ".iset_get_window_number
());
864 if ($args eq "**toggle")
866 if ($options_types[$current_line] eq "boolean")
868 iset_set_option
($options_names[$current_line], "toggle");
871 if ($args eq "**incr")
873 if (($options_types[$current_line] eq "integer")
874 || ($options_types[$current_line] eq "color"))
876 iset_set_option
($options_names[$current_line], "++1");
879 if ($args eq "**decr")
881 if (($options_types[$current_line] eq "integer")
882 || ($options_types[$current_line] eq "color"))
884 iset_set_option
($options_names[$current_line], "--1");
887 if ($args eq "**reset")
889 iset_reset_option
($options_names[$current_line]);
891 if ($args eq "**unset")
893 iset_unset_option
($options_names[$current_line]);
895 if ($args eq "**toggle_help")
897 if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1)
899 weechat
::config_option_set
($options_iset{"show_help_bar"},0,1);
904 weechat
::config_option_set
($options_iset{"show_help_bar"},1,1);
908 if ($args eq "**toggle_show_plugin_desc")
910 if (weechat
::config_boolean
($options_iset{"show_plugin_description"}) == 1)
912 weechat
::config_option_set
($options_iset{"show_plugin_description"},0,1);
914 iset_check_line_outside_window
();
919 weechat
::config_option_set
($options_iset{"show_plugin_description"},1,1);
921 iset_check_line_outside_window
();
925 if ($args eq "**set")
928 my $value = $options_values[$current_line];
929 if ($options_is_null[$current_line])
935 $quote = "\"" if ($options_types[$current_line] eq "string");
937 weechat
::buffer_set
($iset_buffer, "input", "/set ".$options_names[$current_line]." ".$quote.$value.$quote);
938 weechat
::command
($iset_buffer, "/input move_beginning_of_line");
939 weechat
::command
($iset_buffer, "/input move_next_word");
940 weechat
::command
($iset_buffer, "/input move_next_word");
941 weechat
::command
($iset_buffer, "/input move_next_char");
942 weechat
::command
($iset_buffer, "/input move_next_char") if ($quote ne "");
945 weechat
::bar_item_update
("isetbar_help") if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1);
946 return weechat
::WEECHAT_RC_OK
;
951 my ($redraw) = ($_[0]);
953 return '' if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 0);
955 if (not defined $options_names[$current_line])
957 return "No option selected. Set a new filter using command line (use '*' to see all options)";
959 if ($options_name_copy eq $options_names[$current_line] and not defined $redraw)
963 $options_name_copy = $options_names[$current_line];
965 $optionlist = weechat
::infolist_get
("option", "", $options_names[$current_line]);
966 weechat
::infolist_next
($optionlist);
967 my $full_name = weechat
::infolist_string
($optionlist,"full_name");
968 my $option_desc = "";
969 my $option_default_value = "";
970 my $option_range = "";
971 my $possible_values = "";
972 my $re = qq(\Q$full_name);
973 if (grep (/^$re$/,$options_names[$current_line]))
975 $option_desc = weechat
::infolist_string
($optionlist, "description_nls");
976 $option_desc = weechat
::infolist_string
($optionlist, "description") if ($option_desc eq "");
977 $option_desc = "No help found" if ($option_desc eq "");
978 $option_default_value = weechat
::infolist_string
($optionlist, "default_value");
979 $possible_values = weechat
::infolist_string
($optionlist, "string_values") if (weechat
::infolist_string
($optionlist, "string_values") ne "");
980 if ((weechat
::infolist_string
($optionlist, "type") eq "integer") && ($possible_values eq ""))
982 $option_range = weechat
::infolist_integer
($optionlist, "min")
983 ." .. ".weechat
::infolist_integer
($optionlist, "max");
986 weechat
::infolist_free
($optionlist);
989 $description = weechat
::color
(weechat
::config_color
($options_iset{"color_help_option_name"})).$options_names[$current_line]
990 .weechat
::color
("bar_fg").": "
991 .weechat
::color
(weechat
::config_color
($options_iset{"color_help_text"})).$option_desc;
993 # show additional infos like default value and possible values
995 if (weechat
::config_boolean
($options_iset{"show_help_extra_info"}) == 1)
998 weechat
::color
("bar_delim")." ["
999 .weechat
::color
("bar_fg")."default: "
1000 .weechat
::color
("bar_delim")."\""
1001 .weechat
::color
(weechat
::config_color
($options_iset{"color_help_default_value"})).$option_default_value
1002 .weechat
::color
("bar_delim")."\"";
1003 if ($option_range ne "")
1005 $description .= weechat
::color
("bar_fg").", values: ".$option_range;
1007 if ($possible_values ne "")
1009 $possible_values =~ s/\|/", "/g; # replace '|' to '", "'
1010 $description .= weechat
::color
("bar_fg").", values: ". "\"" . $possible_values . "\"";
1013 $description .= weechat
::color
("bar_delim")."]";
1015 return $description;
1018 sub iset_check_condition_isetbar_cb
1020 my ($data, $modifier, $modifier_data, $string) = ($_[0], $_[1], $_[2], $_[3]);
1021 my $buffer = weechat
::window_get_pointer
($modifier_data, "buffer");
1024 if ((weechat
::buffer_get_string
($buffer, "plugin") eq $LANG)
1025 && (weechat
::buffer_get_string
($buffer, "name") eq $PRGNAME))
1036 my $barhidden = weechat
::config_get
("weechat.bar.isetbar.hidden");
1041 if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1)
1043 if (weechat
::config_boolean
($barhidden))
1045 weechat
::config_option_set
($barhidden, 0, 1);
1051 if (!weechat
::config_boolean
($barhidden))
1053 weechat
::config_option_set
($barhidden, 1, 1);
1059 sub iset_signal_buffer_switch_cb
1061 my $buffer_pointer = $_[2];
1063 $show_bar = 1 if (weechat
::buffer_get_integer
($iset_buffer, "num_displayed") > 0);
1064 iset_show_bar
($show_bar);
1065 iset_check_line_outside_window
() if ($buffer_pointer eq $iset_buffer);
1066 return weechat
::WEECHAT_RC_OK
;
1071 return iset_get_help
();
1074 sub iset_upgrade_ended
1076 iset_full_refresh
();
1081 # when script is unloaded, we hide bar
1085 # -------------------------------[ mouse support ]-------------------------------------
1087 sub hook_focus_iset_cb
1089 my %info = %{$_[1]};
1090 my $bar_item_line = int($info{"_bar_item_line"});
1092 if (($info{"_buffer_name"} eq $PRGNAME) && $info{"_buffer_plugin"} eq $LANG && ($bar_item_line >= 0) && ($bar_item_line <= $#iset_focus))
1094 $hash = $iset_focus[$bar_item_line];
1099 my $hash_focus = $iset_focus[0];
1100 foreach my $key (keys %$hash_focus)
1102 $hash->{$key} = "?";
1108 # _chat_line_y contains selected line
1109 sub iset_hsignal_mouse_cb
1111 my ($data, $signal, %hash) = ($_[0], $_[1], %{$_[2]});
1113 if ($hash{"_buffer_name"} eq $PRGNAME && ($hash{"_buffer_plugin"} eq $LANG))
1115 if ($hash{"_key"} eq "button1")
1117 iset_set_current_line
($hash{"_chat_line_y"});
1119 elsif ($hash{"_key"} eq "button2")
1121 if ($options_types[$hash{"_chat_line_y"}] eq "boolean")
1123 iset_set_option
($options_names[$hash{"_chat_line_y"}], "toggle");
1124 iset_set_current_line
($hash{"_chat_line_y"});
1126 elsif ($options_types[$hash{"_chat_line_y"}] eq "string")
1128 iset_set_current_line
($hash{"_chat_line_y"});
1129 weechat
::command
("", "/$PRGNAME **set");
1132 elsif ($hash{"_key"} eq "button2-gesture-left" or $hash{"_key"} eq "button2-gesture-left-long")
1134 if ($options_types[$hash{"_chat_line_y"}] eq "integer" or ($options_types[$hash{"_chat_line_y"}] eq "color"))
1136 iset_set_current_line
($hash{"_chat_line_y"});
1137 my $distance = distance
($hash{"_chat_line_x"},$hash{"_chat_line_x2"});
1138 weechat
::command
("", "/repeat $distance /$PRGNAME **decr");
1141 elsif ($hash{"_key"} eq "button2-gesture-right" or $hash{"_key"} eq "button2-gesture-right-long")
1143 if ($options_types[$hash{"_chat_line_y"}] eq "integer" or ($options_types[$hash{"_chat_line_y"}] eq "color"))
1145 iset_set_current_line
($hash{"_chat_line_y"});
1146 my $distance = distance
($hash{"_chat_line_x"},$hash{"_chat_line_x2"});
1147 weechat
::command
("", "/repeat $distance /$PRGNAME **incr");
1156 my $current_window = weechat
::current_window
();
1157 my $dest_window = weechat
::window_search_with_buffer
(weechat
::buffer_search
("perl","iset"));
1158 return 0 if ($dest_window eq "" or $current_window eq $dest_window);
1160 my $infolist = weechat
::infolist_get
("window", $dest_window, "");
1161 weechat
::infolist_next
($infolist);
1162 my $number = weechat
::infolist_integer
($infolist, "number");
1163 weechat
::infolist_free
($infolist);
1164 weechat
::command
("","/window " . $number);
1169 my ($x1,$x2) = ($_[0], $_[1]);
1171 $distance = $x1 - $x2;
1172 $distance = abs($distance);
1176 $distance = $distance / 3;
1177 $distance = 1 if ($distance == 0);
1179 elsif ($distance == 0)
1186 # -----------------------------------[ config ]---------------------------------------
1188 sub iset_config_init
1190 $iset_config_file = weechat
::config_new
($ISET_CONFIG_FILE_NAME,"iset_config_reload_cb","");
1191 return if ($iset_config_file eq "");
1194 my $section_color = weechat
::config_new_section
($iset_config_file,"color", 0, 0, "", "", "", "", "", "", "", "", "", "");
1195 if ($section_color eq "")
1197 weechat
::config_free
($iset_config_file);
1200 $options_iset{"color_option"} = weechat
::config_new_option
(
1201 $iset_config_file, $section_color,
1202 "option", "color", "Color for option name in iset buffer", "", 0, 0,
1203 "default", "default", 0, "", "", "full_refresh_cb", "", "", "");
1204 $options_iset{"color_option_selected"} = weechat
::config_new_option
(
1205 $iset_config_file, $section_color,
1206 "option_selected", "color", "Color for selected option name in iset buffer", "", 0, 0,
1207 "white", "white", 0, "", "", "full_refresh_cb", "", "", "");
1208 $options_iset{"color_type"} = weechat
::config_new_option
(
1209 $iset_config_file, $section_color,
1210 "type", "color", "Color for option type (integer, boolean, string)", "", 0, 0,
1211 "brown", "brown", 0, "", "", "full_refresh_cb", "", "", "");
1212 $options_iset{"color_type_selected"} = weechat
::config_new_option
(
1213 $iset_config_file, $section_color,
1214 "type_selected", "color", "Color for selected option type (integer, boolean, string)", "", 0, 0,
1215 "yellow", "yellow", 0, "", "", "full_refresh_cb", "", "", "");
1216 $options_iset{"color_value"} = weechat
::config_new_option
(
1217 $iset_config_file, $section_color,
1218 "value", "color", "Color for option value", "", 0, 0,
1219 "cyan", "cyan", 0, "", "", "full_refresh_cb", "", "", "");
1220 $options_iset{"color_value_selected"} = weechat
::config_new_option
(
1221 $iset_config_file, $section_color,
1222 "value_selected", "color", "Color for selected option value", "", 0, 0,
1223 "lightcyan", "lightcyan", 0, "", "", "full_refresh_cb", "", "", "");
1224 $options_iset{"color_value_undef"} = weechat
::config_new_option
(
1225 $iset_config_file, $section_color,
1226 "value_undef", "color", "Color for option value undef", "", 0, 0,
1227 "green", "green", 0, "", "", "full_refresh_cb", "", "", "");
1228 $options_iset{"color_value_undef_selected"} = weechat
::config_new_option
(
1229 $iset_config_file, $section_color,
1230 "value_undef_selected", "color", "Color for selected option value undef", "", 0, 0,
1231 "lightgreen", "lightgreen", 0, "", "", "full_refresh_cb", "", "", "");
1232 $options_iset{"color_bg_selected"} = weechat
::config_new_option
(
1233 $iset_config_file, $section_color,
1234 "bg_selected", "color", "Background color for current selected option", "", 0, 0,
1235 "red", "red", 0, "", "", "full_refresh_cb", "", "", "");
1236 $options_iset{"color_help_option_name"} = weechat
::config_new_option
(
1237 $iset_config_file, $section_color,
1238 "help_option_name", "color", "Color for option name in help-bar", "", 0, 0,
1239 "white", "white", 0, "", "", "bar_refresh", "", "", "");
1240 $options_iset{"color_help_text"} = weechat
::config_new_option
(
1241 $iset_config_file, $section_color,
1242 "help_text", "color", "Color for option description in help-bar", "", 0, 0,
1243 "default", "default", 0, "", "", "bar_refresh", "", "", "");
1244 $options_iset{"color_help_default_value"} = weechat
::config_new_option
(
1245 $iset_config_file, $section_color,
1246 "help_default_value", "color", "Color for default option value in help-bar", "", 0, 0,
1247 "green", "green", 0, "", "", "bar_refresh", "", "", "");
1250 my $section_help = weechat
::config_new_section
($iset_config_file,"help", 0, 0, "", "", "", "", "", "", "", "", "", "");
1251 if ($section_help eq "")
1253 weechat
::config_free
($iset_config_file);
1256 $options_iset{"show_help_bar"} = weechat
::config_new_option
(
1257 $iset_config_file, $section_help,
1258 "show_help_bar", "boolean", "Show help bar", "", 0, 0,
1259 "on", "on", 0, "", "", "toggle_help_cb", "", "", "");
1260 $options_iset{"show_help_extra_info"} = weechat
::config_new_option
(
1261 $iset_config_file, $section_help,
1262 "show_help_extra_info", "boolean", "Show additional information in help bar (default value, max./min. value) ", "", 0, 0,
1263 "on", "on", 0, "", "", "", "", "", "");
1264 $options_iset{"show_plugin_description"} = weechat
::config_new_option
(
1265 $iset_config_file, $section_help,
1266 "show_plugin_description", "boolean", "Show plugin description in iset buffer", "", 0, 0,
1267 "off", "off", 0, "", "", "full_refresh_cb", "", "", "");
1270 my $section_look = weechat
::config_new_section
($iset_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "");
1271 if ($section_look eq "")
1273 weechat
::config_free
($iset_config_file);
1276 $options_iset{"value_search_char"} = weechat
::config_new_option
(
1277 $iset_config_file, $section_look,
1278 "value_search_char", "string", "Trigger char to tell iset to search for value instead of option (for example: =red)", "", 0, 0,
1279 "=", "=", 0, "", "", "", "", "", "");
1280 $options_iset{"scroll_horiz"} = weechat
::config_new_option
(
1281 $iset_config_file, $section_look,
1282 "scroll_horiz", "integer", "scroll content of iset buffer n%", "", 1, 100,
1283 "10", "10", 0, "", "", "", "", "", "");
1284 $options_iset{"show_current_line"} = weechat
::config_new_option
(
1285 $iset_config_file, $section_look,
1286 "show_current_line", "boolean", "show current line in title bar.", "", 0, 0,
1287 "on", "on", 0, "", "", "", "", "", "");
1290 sub iset_config_reload_cb
1292 my ($data,$config_file) = ($_[0], $_[1]);
1293 return weechat
::config_reload
($config_file)
1296 sub iset_config_read
1298 return weechat
::config_read
($iset_config_file) if ($iset_config_file ne "");
1301 sub iset_config_write
1303 return weechat
::config_write
($iset_config_file) if ($iset_config_file ne "");
1308 iset_full_refresh
();
1309 return weechat
::WEECHAT_RC_OK
;
1315 weechat
::bar_item_update
("isetbar_help") if (weechat
::config_boolean
($options_iset{"show_help_bar"}) == 1);
1316 return weechat
::WEECHAT_RC_OK
;
1321 my $value = weechat
::config_boolean
($options_iset{"show_help_bar"});
1322 iset_show_bar
($value);
1323 return weechat
::WEECHAT_RC_OK
;
1326 # -----------------------------------[ main ]-----------------------------------------
1328 weechat
::register
($PRGNAME, $AUTHOR, $VERSION, $LICENSE,
1329 $DESCR, "iset_end", "");
1331 $wee_version_number = weechat
::info_get
("version_number", "") || 0;
1336 weechat
::hook_command
($PRGNAME, "Interactive set", "f <file> || s <section> || [=][=]<text>",
1337 "f file : show options for a file\n".
1338 "s section: show options for a section\n".
1339 "text : show options with 'text' in name\n".
1340 weechat
::config_string
($options_iset{"value_search_char"})."text : show options with 'text' in value\n".
1341 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".
1342 "Keys for iset buffer:\n".
1343 "f11,f12 : move iset content left/right\n".
1344 "up,down : move one option up/down\n".
1345 "pgup,pdwn : move one page up/down\n".
1346 "home,end : move to first/last option\n".
1347 "ctrl+'L' : refresh options and screen\n".
1348 "alt+space : toggle boolean on/off\n".
1349 "alt+'+' : increase value (for integer or color)\n".
1350 "alt+'-' : decrease value (for integer or color)\n".
1351 "alt+'i',alt+'r': reset value of option\n".
1352 "alt+'i',alt+'u': unset option\n".
1353 "alt+enter : set new value for option (edit it with command line)\n".
1354 "text,enter : set a new filter using command line (use '*' to see all options)\n".
1355 "alt+'v' : toggle help bar on/off\n".
1356 "alt+'p' : toggle option \"show_plugin_description\" on/off\n".
1359 "wheel up/down : move cursor up/down\n".
1360 "left button : select an option from list\n".
1361 "right button : toggle boolean (on/off) or set a new value for option (edit it with command line)\n".
1362 "right button + drag left/right: increase/decrease value (for integer or color)\n".
1365 " show options for file 'weechat'\n".
1366 " /iset f weechat\n".
1367 " show options for file 'irc'\n".
1369 " show options for section 'look'\n".
1371 " show all options with text 'nicklist' in name\n".
1372 " /iset nicklist\n".
1373 " show all values which contain 'red'. ('" . weechat
::config_string
($options_iset{"value_search_char"}) . "' is a trigger char).\n".
1374 " /iset ". weechat
::config_string
($options_iset{"value_search_char"}) ."red\n".
1375 " 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".
1376 " /iset ". weechat
::config_string
($options_iset{"value_search_char"}) . weechat
::config_string
($options_iset{"value_search_char"}) ."off\n".
1377 " show options for file 'weechat' which contains value 'off'\n".
1378 " /iset f weechat ".weechat
::config_string
($options_iset{"value_search_char"})."off\n".
1380 "", "iset_cmd_cb", "");
1381 weechat
::hook_signal
("upgrade_ended", "iset_upgrade_ended", "");
1382 weechat
::hook_signal
("window_scrolled", "iset_signal_window_scrolled_cb", "");
1383 weechat
::hook_signal
("buffer_switch", "iset_signal_buffer_switch_cb","");
1384 weechat
::bar_item_new
("isetbar_help", "iset_item_cb", "");
1385 weechat
::bar_new
("isetbar", "on", "0", "window", "", "top", "horizontal",
1386 "vertical", "3", "3", "default", "cyan", "default", "1",
1388 weechat
::hook_modifier
("bar_condition_isetbar", "iset_check_condition_isetbar_cb", "");
1389 weechat
::hook_config
("*", "iset_config_cb", "");
1390 $iset_buffer = weechat
::buffer_search
($LANG, $PRGNAME);
1391 iset_init
() if ($iset_buffer ne "");
1393 if ($wee_version_number >= 0x00030600)
1395 weechat
::hook_focus
("chat", "hook_focus_iset_cb", "");
1396 weechat
::hook_hsignal
($PRGNAME."_mouse", "iset_hsignal_mouse_cb", "");
1397 weechat
::key_bind
("mouse", \
%mouse_keys);