… | |
… | |
9 | #:META:X_RESOURCE:%.launcher.:string:custom launcher for pattern |
9 | #:META:X_RESOURCE:%.launcher.:string:custom launcher for pattern |
10 | #:META:X_RESOURCE:%.rend.:string:custom rednition for pattern |
10 | #:META:X_RESOURCE:%.rend.:string:custom rednition for pattern |
11 | |
11 | |
12 | =head1 NAME |
12 | =head1 NAME |
13 | |
13 | |
14 | matcher - match strings in terminal output and change their rendition |
14 | matcher - match strings in terminal output and change their rendition |
15 | |
15 | |
16 | =head1 DESCRPTION |
16 | =head1 DESCRIPTION |
17 | |
17 | |
18 | Uses per-line display filtering (C<on_line_update>) to underline text |
18 | Uses per-line display filtering (C<on_line_update>) to underline text |
19 | matching a certain pattern and make it clickable. When clicked with the |
19 | matching a certain pattern and make it clickable. When clicked with the |
20 | mouse button specified in the C<matcher.button> resource (default 2, or |
20 | mouse button specified in the C<matcher.button> resource (default 2, or |
21 | middle), the program specified in the C<matcher.launcher> resource |
21 | middle), the program specified in the C<matcher.launcher> resource |
… | |
… | |
47 | =cut |
47 | =cut |
48 | |
48 | |
49 | my $url = |
49 | my $url = |
50 | qr{ |
50 | qr{ |
51 | (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) |
51 | (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) |
52 | [a-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27,~#]* |
52 | [\w\-\@;\/?:&=%\$.+!*\x27,~#]* |
53 | ( |
53 | ( |
54 | \([a-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27,~#]*\)| # Allow a pair of matched parentheses |
54 | \([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\)| # Allow a pair of matched parentheses |
55 | [a-zA-Z0-9\-\@;\/?:&=%\$_+*~] # exclude some trailing characters (heuristic) |
55 | [\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic) |
56 | )+ |
56 | )+ |
57 | }x; |
57 | }x; |
58 | |
58 | |
59 | sub on_key_press { |
59 | sub on_key_press { |
60 | my ($self, $event, $keysym, $octets) = @_; |
60 | my ($self, $event, $keysym, $octets) = @_; |