~ubuntu-branches/ubuntu/utopic/rxvt-unicode/utopic-proposed

« back to all changes in this revision

Viewing changes to src/perl/selection

  • Committer: Package Import Robot
  • Author(s): Ryan Kavanagh
  • Date: 2013-05-26 18:12:22 UTC
  • mfrom: (33.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130526181222-67glcv7nppi4ih7r
Tags: 9.18-2
* Upload to unstable now that wheezy has been released
* Merge in patch from gregor herrman fixing a FTBFS due to POD errors
  (Closes: #708026)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! perl
2
2
 
 
3
#:META:X_RESOURCE:%.pattern-0:string:first selection pattern
 
4
 
 
5
=head1 NAME
 
6
 
 
7
selection - more intelligent selection (enabled by default)
 
8
 
 
9
=head1 DESCRIPTION
 
10
 
 
11
This extension tries to be more intelligent when the user extends
 
12
selections (double-click and further clicks). Right now, it tries to
 
13
select words, urls and complete shell-quoted arguments, which is very
 
14
convenient, too, if your F<ls> supports C<--quoting-style=shell>.
 
15
 
 
16
A double-click usually selects the word under the cursor, further clicks
 
17
will enlarge the selection.
 
18
 
 
19
The selection works by trying to match a number of regexes and displaying
 
20
them in increasing order of length. You can add your own regexes by
 
21
specifying resources of the form:
 
22
 
 
23
   URxvt.selection.pattern-0: perl-regex
 
24
   URxvt.selection.pattern-1: perl-regex
 
25
   ...
 
26
 
 
27
The index number (0, 1...) must not have any holes, and each regex must
 
28
contain at least one pair of capturing parentheses, which will be used for
 
29
the match. For example, the following adds a regex that matches everything
 
30
between two vertical bars:
 
31
 
 
32
   URxvt.selection.pattern-0: \\|([^|]+)\\|
 
33
 
 
34
Another example: Programs I use often output "absolute path: " at the
 
35
beginning of a line when they process multiple files. The following
 
36
pattern matches the filename (note, there is a single space at the very
 
37
end):
 
38
 
 
39
   URxvt.selection.pattern-0: ^(/[^:]+):\ 
 
40
 
 
41
You can look at the source of the selection extension to see more
 
42
interesting uses, such as parsing a line from beginning to end.
 
43
 
 
44
This extension also offers following bindable keyboard commands:
 
45
 
 
46
=over 4
 
47
 
 
48
=item rot13
 
49
 
 
50
Rot-13 the selection when activated. Used via keyboard trigger:
 
51
 
 
52
   URxvt.keysym.C-M-r: perl:selection:rot13
 
53
 
 
54
=back
 
55
 
 
56
=cut
 
57
 
3
58
sub on_user_command {
4
59
   my ($self, $cmd) = @_;
5
60