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.25 by root, Wed Jun 6 15:06:41 2012 UTC vs.
Revision 1.26 by root, Sun Jun 10 17:31:53 2012 UTC

1#! perl 1#! perl
2 2
3#:META:X_RESOURCE:url-launcher:string:shell command to use 3#:META:X_RESOURCE:url-launcher:string:shell command to use
4
5=head1 NAME
6
7 selection-popup (enabled by default)
8
9=head1 DESCRIPTION
10
11Binds a popup menu to Ctrl-Button3 that lets you convert the selection
12text into various other formats/action (such as uri unescaping, perl
13evaluation, web-browser starting etc.), depending on content.
14
15Other extensions can extend this popup menu by pushing a code reference
16onto C<@{ $term->{selection_popup_hook} }>, which gets called whenever the
17popup is being displayed.
18
19Its sole argument is the popup menu, which can be modified. The selection
20is in C<$_>, which can be used to decide whether to add something or not.
21It should either return nothing or a string and a code reference. The
22string will be used as button text and the code reference will be called
23when the button gets activated and should transform C<$_>.
24
25The following will add an entry C<a to b> that transforms all C<a>s in
26the selection to C<b>s, but only if the selection currently contains any
27C<a>s:
28
29 push @{ $self->{term}{selection_popup_hook} }, sub {
30 /a/ ? ("a to b" => sub { s/a/b/g }
31 : ()
32 };
33
34=cut
4 35
5sub msg { 36sub msg {
6 my ($self, $msg) = @_; 37 my ($self, $msg) = @_;
7 38
8 my $overlay = $self->overlay (0, 0, $self->strwidth ($msg), 1); 39 my $overlay = $self->overlay (0, 0, $self->strwidth ($msg), 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines