repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 4ccd637f2589baf12d17579dd6b5657f877a6788:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 4ccd637f2589baf12d17579dd6b5657f877a6788
Author: Marc Lehmann 
Date:   Sat Jan 7 21:43:17 2006 +0000

    *** empty log message ***

diff --git a/src/perl/urxvt-popup b/src/perl/urxvt-popup
index cd902fdbd4e38a5238556621a3e2997f1a29e34a..
index ..8a385bfd8b718812417699ad4f7bf7aa70364038 100644
--- a/src/perl/urxvt-popup
+++ b/src/perl/urxvt-popup
@@ -18,7 +18,9 @@ sub refresh {
          $rend = $self->{press} ? "\x1b[m" : "\x1b[30;46m";
       }

-      $cmd .= "$rend\x1b[K" . $self->locale_encode ($item->{text}) . "\015\012";
+      $cmd .= "$rend\x1b[K";
+      $cmd .= $self->locale_encode ($item->{render}->($item));
+      $cmd .= "\015\012";

       $row++;
    }
diff --git a/src/urxvt.pm b/src/urxvt.pm
index 36ed839a349f3b413b3397bcf124aad4b6901f53..
index ..bf22500b95510d392c2d2b68e1f979cf889ea43b 100644
--- a/src/urxvt.pm
+++ b/src/urxvt.pm
@@ -399,8 +399,10 @@ Change the custom value.

 package urxvt;

+use utf8;
 use strict;
 use Scalar::Util ();
+use List::Util ();

 our $TERM;
 our @HOOKNAME;
@@ -1002,7 +1004,18 @@ sub add_item {
 sub add_button {
    my ($self, $text, $cb) = @_;

-   $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb });
+   $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb,
+      render => sub { $_[0]{text} },
+   });
+}
+
+sub add_toggle {
+   my ($self, $text, $cb, $value) = @_;
+
+   $self->add_item ({ type => "button", text => "  $text", value => $value,
+      render => sub { ($_[0]{value} ? "✔" : " ") . substr $_[0]{text}, 1 },
+      activate => sub { $cb->($_[0]{value} = !$_[0]{value}); },
+   });
 }

 sub show {

-----END OF PAGE-----