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.13 by root, Wed Jan 18 11:05:09 2006 UTC vs.
Revision 1.16 by root, Thu Jan 19 21:03:34 2006 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 $_ });
63 64
64 /^(\S+):(\d+):?$/ 65 /^(\S+):(\d+):?$/
65 and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ }); 66 and $add_button->("vi-commands to load '$1'" => sub { s/^(\S+):(\d+):?$/\x1b:e $1\x0d:$2\x0d/ });
66 67
67 /%[0-9a-fA-F]{2}/ && !/%[^0-9a-fA-F]/ && !/%.[^0-9a-fA-F]/ 68 /%[0-9a-fA-F]{2}/ && !/%[^0-9a-fA-F]/ && !/%.[^0-9a-fA-F]/
69 70
70 /[\\"'\ \t|&;<>()]/ 71 /[\\"'\ \t|&;<>()]/
71 and $add_button->("shell quote" => sub { $_ = "\Q$_" }); 72 and $add_button->("shell quote" => sub { $_ = "\Q$_" });
72 73
73 /^(http|ftp|telnet|irc|news):\// 74 /^(http|ftp|telnet|irc|news):\//
74 and $add_button->("run $self->{browser}" => sub { urxvt::exec_async $self->{browser}, $_ }); 75 and $add_button->("run $self->{browser}" => sub { $self->exec_async ($self->{browser}, $_) });
75 76
76 for my $hook (@hook) { 77 for my $hook (@{ $self->{term}{selection_popup_hook} || [] }) {
77 if (my ($title, $cb) = $hook->($popup)) { 78 if (my ($title, $cb) = $hook->($popup)) {
78 $add_button->($title, $cb); 79 $add_button->($title, $cb);
79 } 80 }
80 } 81 }
81 82

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines