ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/matcher
(Generate patch)

Comparing rxvt-unicode/src/perl/matcher (file contents):
Revision 1.18 by sf-exg, Sun Jun 1 11:47:20 2014 UTC vs.
Revision 1.19 by sf-exg, Sat Jun 7 20:07:38 2014 UTC

102 while ($row >= 0 && @{ $self->{matches} } < 10) { 102 while ($row >= 0 && @{ $self->{matches} } < 10) {
103 my $line = $self->line ($row); 103 my $line = $self->line ($row);
104 my $text = $line->t; 104 my $text = $line->t;
105 105
106 # FIXME: code duplicated from 'command_for' 106 # FIXME: code duplicated from 'command_for'
107 my @matches;
107 for my $matcher (@{$self->{matchers}}) { 108 for my $matcher (@{$self->{matchers}}) {
108 my $launcher = $matcher->[1] || $self->{launcher}; 109 my $launcher = $matcher->[1] || $self->{launcher};
109 while ($text =~ /$matcher->[0]/g) { 110 while ($text =~ /$matcher->[0]/g) {
110 my $match = substr ($text, $-[0], $+[0] - $-[0]); 111 my $match = substr ($text, $-[0], $+[0] - $-[0]);
111 my @beg = @-; 112 my @beg = @-;
118 @exec = map { s/\$(\d+)|\$\{(\d+)\}/ 119 @exec = map { s/\$(\d+)|\$\{(\d+)\}/
119 substr ($text, $beg[$1 || $2], $end[$1 || $2] - $beg[$1 || $2]) 120 substr ($text, $beg[$1 || $2], $end[$1 || $2] - $beg[$1 || $2])
120 /egx; $_ } split /\s+/, $launcher; 121 /egx; $_ } split /\s+/, $launcher;
121 } 122 }
122 123
123 push @{ $self->{matches} }, [ $match, @exec ]; 124 push @matches, [ $beg[0], $match, @exec ];
124 } 125 }
126 }
127
128 for (sort { $b->[0] <=> $a->[0] } @matches) {
129 shift @$_;
130 push @{ $self->{matches} }, $_;
131 last if @{ $self->{matches} } == 10;
125 } 132 }
126 133
127 $row = $line->beg - 1; 134 $row = $line->beg - 1;
128 } 135 }
129 136

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines