]> git.rmz.io Git - dotfiles.git/blobdiff - weechat/perl/iset.pl
weechat: update scripts + configs
[dotfiles.git] / weechat / perl / iset.pl
index 377b7c3608b4324eb7f06e49f0872d75acd45107..4b922eefbaacd346bd31b0108630bf07dda07542 100644 (file)
@@ -19,6 +19,8 @@
 #
 # History:
 #
 #
 # History:
 #
+# 2014-01-30, stfn <stfnmd@gmail.com>:
+#     version 3.4: add new options "color_value_diff" and "color_value_diff_selected"
 # 2014-01-16, luz <ne.tetewi@gmail.com>:
 #     version 3.3: fix bug with column alignment in iset buffer when option
 #                  name contains unicode characters
 # 2014-01-16, luz <ne.tetewi@gmail.com>:
 #     version 3.3: fix bug with column alignment in iset buffer when option
 #                  name contains unicode characters
 use strict;
 
 my $PRGNAME = "iset";
 use strict;
 
 my $PRGNAME = "iset";
-my $VERSION = "3.3";
+my $VERSION = "3.4";
 my $DESCR   = "Interactive Set for configuration options";
 my $AUTHOR  = "Sebastien Helleu <flashcode\@flashtux.org>";
 my $LICENSE = "GPL3";
 my $DESCR   = "Interactive Set for configuration options";
 my $AUTHOR  = "Sebastien Helleu <flashcode\@flashtux.org>";
 my $LICENSE = "GPL3";
@@ -125,6 +127,7 @@ my @iset_focus = ();
 my @options_names = ();
 my @options_types = ();
 my @options_values = ();
 my @options_names = ();
 my @options_types = ();
 my @options_values = ();
+my @options_default_values = ();
 my @options_is_null = ();
 my $option_max_length = 0;
 my $current_line = 0;
 my @options_is_null = ();
 my $option_max_length = 0;
 my $current_line = 0;
@@ -328,6 +331,7 @@ sub iset_get_options
     @options_names = ();
     @options_types = ();
     @options_values = ();
     @options_names = ();
     @options_types = ();
     @options_values = ();
+    @options_default_values = ();
     @options_is_null = ();
     $option_max_length = 0;
     my %options_internal = ();
     @options_is_null = ();
     $option_max_length = 0;
     my %options_internal = ();
@@ -346,6 +350,7 @@ sub iset_get_options
         next if (weechat::config_boolean($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1);
         my $type = weechat::infolist_string($infolist, "type");
         my $value = weechat::infolist_string($infolist, "value");
         next if (weechat::config_boolean($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1);
         my $type = weechat::infolist_string($infolist, "type");
         my $value = weechat::infolist_string($infolist, "value");
+        my $default_value = weechat::infolist_string($infolist, "default_value");
         my $is_null = weechat::infolist_integer($infolist, "value_is_null");
         if ($search_mode == 3)
         {
         my $is_null = weechat::infolist_integer($infolist, "value_is_null");
         if ($search_mode == 3)
         {
@@ -354,6 +359,7 @@ sub iset_get_options
             {
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
             {
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
+                $options_internal{$name}{"default_value"} = $default_value;
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
         $iset_struct{$key} = $options_internal{$name};
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
         $iset_struct{$key} = $options_internal{$name};
@@ -364,6 +370,7 @@ sub iset_get_options
         {
             $options_internal{$name}{"type"} = $type;
             $options_internal{$name}{"value"} = $value;
         {
             $options_internal{$name}{"type"} = $type;
             $options_internal{$name}{"value"} = $value;
+            $options_internal{$name}{"default_value"} = $default_value;
             $options_internal{$name}{"is_null"} = $is_null;
             $option_max_length = length($name) if (length($name) > $option_max_length);
         $iset_struct{$key} = $options_internal{$name};
             $options_internal{$name}{"is_null"} = $is_null;
             $option_max_length = length($name) if (length($name) > $option_max_length);
         $iset_struct{$key} = $options_internal{$name};
@@ -378,6 +385,7 @@ sub iset_get_options
         push(@options_names, $name);
         push(@options_types, $options_internal{$name}{"type"});
         push(@options_values, $options_internal{$name}{"value"});
         push(@options_names, $name);
         push(@options_types, $options_internal{$name}{"type"});
         push(@options_values, $options_internal{$name}{"value"});
+        push(@options_default_values, $options_internal{$name}{"default_value"});
         push(@options_is_null, $options_internal{$name}{"is_null"});
     }
 }
         push(@options_is_null, $options_internal{$name}{"is_null"});
     }
 }
@@ -402,6 +410,7 @@ sub iset_search_values
     @options_names = ();
     @options_types = ();
     @options_values = ();
     @options_names = ();
     @options_types = ();
     @options_values = ();
+    @options_default_values = ();
     @options_is_null = ();
     $option_max_length = 0;
     my %options_internal = ();
     @options_is_null = ();
     $option_max_length = 0;
     my %options_internal = ();
@@ -414,12 +423,14 @@ sub iset_search_values
         my $type = weechat::infolist_string($infolist, "type");
         my $is_null = weechat::infolist_integer($infolist, "value_is_null");
         my $value = weechat::infolist_string($infolist, "value");
         my $type = weechat::infolist_string($infolist, "type");
         my $is_null = weechat::infolist_integer($infolist, "value_is_null");
         my $value = weechat::infolist_string($infolist, "value");
+        my $default_value = weechat::infolist_string($infolist, "default_value");
         if ($search_mode)
         {
             if ( grep /\Q$var_value/,lc($value) )
             {
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
         if ($search_mode)
         {
             if ( grep /\Q$var_value/,lc($value) )
             {
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
+                $options_internal{$name}{"default_value"} = $default_value;
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
             }
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
             }
@@ -431,6 +442,7 @@ sub iset_search_values
             {
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
             {
                 $options_internal{$name}{"type"} = $type;
                 $options_internal{$name}{"value"} = $value;
+                $options_internal{$name}{"default_value"} = $default_value;
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
             }
                 $options_internal{$name}{"is_null"} = $is_null;
                 $option_max_length = length($name) if (length($name) > $option_max_length);
             }
@@ -443,6 +455,7 @@ sub iset_search_values
         push(@options_names, $name);
         push(@options_types, $options_internal{$name}{"type"});
         push(@options_values, $options_internal{$name}{"value"});
         push(@options_names, $name);
         push(@options_types, $options_internal{$name}{"type"});
         push(@options_values, $options_internal{$name}{"value"});
+        push(@options_default_values, $options_internal{$name}{"default_value"});
         push(@options_is_null, $options_internal{$name}{"is_null"});
     }
 }
         push(@options_is_null, $options_internal{$name}{"is_null"});
     }
 }
@@ -475,6 +488,10 @@ sub iset_refresh_line
             {
                 $color3 = weechat::color(weechat::config_color($options_iset{"color_value_undef"}));
             }
             {
                 $color3 = weechat::color(weechat::config_color($options_iset{"color_value_undef"}));
             }
+            elsif ($options_values[$y] ne $options_default_values[$y])
+            {
+                $color3 = weechat::color(weechat::config_color($options_iset{"color_value_diff"}));
+            }
             else
             {
                 $color3 = weechat::color(weechat::config_color($options_iset{"color_value"}));
             else
             {
                 $color3 = weechat::color(weechat::config_color($options_iset{"color_value"}));
@@ -487,6 +504,10 @@ sub iset_refresh_line
                 {
                     $color3 = weechat::color(weechat::config_color($options_iset{"color_value_undef_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"}));
                 }
                 {
                     $color3 = weechat::color(weechat::config_color($options_iset{"color_value_undef_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"}));
                 }
+                elsif ($options_values[$y] ne $options_default_values[$y])
+                {
+                    $color3 = weechat::color(weechat::config_color($options_iset{"color_value_diff_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"}));
+                }
                 else
                 {
                     $color3 = weechat::color(weechat::config_color($options_iset{"color_value_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"}));
                 else
                 {
                     $color3 = weechat::color(weechat::config_color($options_iset{"color_value_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"}));
@@ -687,6 +708,7 @@ sub iset_config_cb
                 {
                     $options_types[$index] = weechat::infolist_string($infolist, "type");
                     $options_values[$index] = weechat::infolist_string($infolist, "value");
                 {
                     $options_types[$index] = weechat::infolist_string($infolist, "type");
                     $options_values[$index] = weechat::infolist_string($infolist, "value");
+                    $options_default_values[$index] = weechat::infolist_string($infolist, "default_value");
                     $options_is_null[$index] = weechat::infolist_integer($infolist, "value_is_null");
                     iset_refresh_line($index);
                     iset_title() if ($option_name eq "iset.look.show_current_line");
                     $options_is_null[$index] = weechat::infolist_integer($infolist, "value_is_null");
                     iset_refresh_line($index);
                     iset_title() if ($option_name eq "iset.look.show_current_line");
@@ -1233,6 +1255,14 @@ sub iset_config_init
         $iset_config_file, $section_color,
         "value_selected", "color", "Color for selected option value", "", 0, 0,
         "lightcyan", "lightcyan", 0, "", "", "full_refresh_cb", "", "", "");
         $iset_config_file, $section_color,
         "value_selected", "color", "Color for selected option value", "", 0, 0,
         "lightcyan", "lightcyan", 0, "", "", "full_refresh_cb", "", "", "");
+    $options_iset{"color_value_diff"} = weechat::config_new_option(
+        $iset_config_file, $section_color,
+        "value_diff", "color", "Color for option value different from default", "", 0, 0,
+        "magenta", "magenta", 0, "", "", "full_refresh_cb", "", "", "");
+    $options_iset{"color_value_diff_selected"} = weechat::config_new_option(
+        $iset_config_file, $section_color,
+        "value_diff_selected", "color", "Color for selected option value different from default", "", 0, 0,
+        "lightmagenta", "lightmagenta", 0, "", "", "full_refresh_cb", "", "", "");
     $options_iset{"color_value_undef"} = weechat::config_new_option(
         $iset_config_file, $section_color,
         "value_undef", "color", "Color for option value undef", "", 0, 0,
     $options_iset{"color_value_undef"} = weechat::config_new_option(
         $iset_config_file, $section_color,
         "value_undef", "color", "Color for option value undef", "", 0, 0,