… | |
… | |
111 | |
111 | |
112 | @{ $self->{matches} } = (); |
112 | @{ $self->{matches} } = (); |
113 | my $row = $self->nrow - 1; |
113 | my $row = $self->nrow - 1; |
114 | while ($row >= 0 && @{ $self->{matches} } < 10) { |
114 | while ($row >= 0 && @{ $self->{matches} } < 10) { |
115 | my $line = $self->line ($row); |
115 | my $line = $self->line ($row); |
116 | my @matches = $self->find_matches ($row, 0); |
116 | my @matches = $self->find_matches ($row); |
117 | |
117 | |
118 | for (sort { $b->[0] <=> $a->[0] } @matches) { |
118 | for (sort { $b->[0] <=> $a->[0] } @matches) { |
119 | shift @$_; |
119 | shift @$_; |
120 | push @{ $self->{matches} }, $_; |
120 | push @{ $self->{matches} }, $_; |
121 | last if @{ $self->{matches} } == 10; |
121 | last if @{ $self->{matches} } == 10; |
… | |
… | |
276 | @exec = ($launcher, $match); |
276 | @exec = ($launcher, $match); |
277 | } else { |
277 | } else { |
278 | # It'd be nice to just access a list like ($&,$1,$2...), |
278 | # It'd be nice to just access a list like ($&,$1,$2...), |
279 | # but alas, m//g behaves differently in list context. |
279 | # but alas, m//g behaves differently in list context. |
280 | @exec = map { s/\$(\d+)|\$\{(\d+)\}/ |
280 | @exec = map { s/\$(\d+)|\$\{(\d+)\}/ |
281 | substr $text, $begin[$1 || $2], $end[$1 || $2] - $begin[$1 || $2]) |
281 | substr $text, $begin[$1 || $2], $end[$1 || $2] - $begin[$1 || $2] |
282 | /egx; $_ } split /\s+/, $launcher; |
282 | /egx; $_ } split /\s+/, $launcher; |
283 | } |
283 | } |
284 | |
284 | |
285 | push @matches, [ $begin[0], $match, @exec ]; |
285 | push @matches, [ $begin[0], $match, @exec ]; |
286 | } |
286 | } |