ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/selection-popup
(Generate patch)

Comparing rxvt-unicode/src/perl/selection-popup (file contents):
Revision 1.20 by ayin, Wed Oct 31 18:12:27 2007 UTC vs.
Revision 1.25 by root, Wed Jun 6 15:06:41 2012 UTC

1#! perl 1#! perl
2
3#:META:X_RESOURCE:url-launcher:string:shell command to use
2 4
3sub msg { 5sub msg {
4 my ($self, $msg) = @_; 6 my ($self, $msg) = @_;
5 7
6 my $overlay = $self->overlay (0, 0, $self->strwidth ($msg), 1); 8 my $overlay = $self->overlay (0, 0, $self->strwidth ($msg), 1);
12} 14}
13 15
14sub on_start { 16sub on_start {
15 my ($self) = @_; 17 my ($self) = @_;
16 18
17 $self->{browser} = $self->x_resource ("urlLauncher") || "x-www-browser"; 19 $self->{browser} = $self->x_resource ("url-launcher") || "sensible-browser";
18 20
19 $self->grab_button (3, urxvt::ControlMask); 21 $self->grab_button (3, urxvt::ControlMask);
20 22
21 () 23 ()
22} 24}
54 } 56 }
55 }); 57 });
56 }; 58 };
57 59
58 for ($text) { 60 for ($text) {
61 /\n/
62 and $add_button->("newlines to spaces" => sub { y/\n/ / });
63
59 /./ 64 /./
60 and $add_button->("rot13" => sub { y/A-Za-z/N-ZA-Mn-za-m/ }); 65 and $add_button->("rot13" => sub { y/A-Za-z/N-ZA-Mn-za-m/ });
61 66
62 /./ 67 /./
63 and $add_button->("eval perl expression" => sub { no warnings; $_ = eval $_ }); 68 and $add_button->("eval perl expression" => sub { my $self = $self; no warnings; $_ = eval $_; $_ = "$@" if $@ });
64 69
65 /./ 70 /./
66 and $add_button->((sprintf "to unicode hex index (%x)", ord) => sub { $_ = sprintf "%x", ord }); 71 and $add_button->((sprintf "to unicode hex index (%x)", ord) => sub { $_ = sprintf "%x", ord });
67 72
68 /^(\S+):(\d+):?$/ 73 /(\S+):(\d+):?/
69 and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ }); 74 and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ });
70 75
71 /%[0-9a-fA-F]{2}/ && !/%[^0-9a-fA-F]/ && !/%.[^0-9a-fA-F]/ 76 /%[0-9a-fA-F]{2}/ && !/%[^0-9a-fA-F]/ && !/%.[^0-9a-fA-F]/
72 and $add_button->("uri unescape" => sub { s/%([0-9a-fA-F]{2})/chr hex $1/ge }); 77 and $add_button->("uri unescape" => sub { s/%([0-9a-fA-F]{2})/chr hex $1/ge });
73 78

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines