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.14 by root, Thu Jan 19 09:47:15 2006 UTC vs.
Revision 1.20 by ayin, Wed Oct 31 18:12:27 2007 UTC

18 18
19 $self->grab_button (3, urxvt::ControlMask); 19 $self->grab_button (3, urxvt::ControlMask);
20 20
21 () 21 ()
22} 22}
23
24our @hook;
25 23
26sub on_button_press { 24sub on_button_press {
27 my ($self, $event) = @_; 25 my ($self, $event) = @_;
28 26
29 if ($event->{button} == 3 && $event->{state} & urxvt::ControlMask) { 27 if ($event->{button} == 3 && $event->{state} & urxvt::ControlMask) {
56 } 54 }
57 }); 55 });
58 }; 56 };
59 57
60 for ($text) { 58 for ($text) {
59 /./
61 $add_button->("rot13" => sub { y/A-Za-z/N-ZA-Mn-za-m/ }); 60 and $add_button->("rot13" => sub { y/A-Za-z/N-ZA-Mn-za-m/ });
61
62 /./
62 $add_button->("eval perl expression" => sub { no warnings; $_ = eval $_ }); 63 and $add_button->("eval perl expression" => sub { no warnings; $_ = eval $_ });
64
65 /./
66 and $add_button->((sprintf "to unicode hex index (%x)", ord) => sub { $_ = sprintf "%x", ord });
63 67
64 /^(\S+):(\d+):?$/ 68 /^(\S+):(\d+):?$/
65 and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ }); 69 and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ });
66 70
67 /%[0-9a-fA-F]{2}/ && !/%[^0-9a-fA-F]/ && !/%.[^0-9a-fA-F]/ 71 /%[0-9a-fA-F]{2}/ && !/%[^0-9a-fA-F]/ && !/%.[^0-9a-fA-F]/
68 and $add_button->("uri unescape" => sub { s/%([0-9a-fA-F]{2})/chr hex $1/ge }); 72 and $add_button->("uri unescape" => sub { s/%([0-9a-fA-F]{2})/chr hex $1/ge });
69 73
70 /[\\"'\ \t|&;<>()]/ 74 /[\\"'\ \t|&;<>()]/
71 and $add_button->("shell quote" => sub { $_ = "\Q$_" }); 75 and $add_button->("shell quote" => sub { $_ = "\Q$_" });
72 76
73 /^(http|ftp|telnet|irc|news):\// 77 /^(https?|ftp|telnet|irc|news):\//
74 and $add_button->("run $self->{browser}" => sub { $self->exec_async ($self->{browser}, $_) }); 78 and $add_button->("run $self->{browser}" => sub { $self->exec_async ($self->{browser}, $_) });
75 79
76 for my $hook (@hook) { 80 for my $hook (@{ $self->{term}{selection_popup_hook} || [] }) {
77 if (my ($title, $cb) = $hook->($popup)) { 81 if (my ($title, $cb) = $hook->($popup)) {
78 $add_button->($title, $cb); 82 $add_button->($title, $cb);
79 } 83 }
80 } 84 }
81 85

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines