… | |
… | |
259 | |
259 | |
260 | sub find_matches { |
260 | sub find_matches { |
261 | my ($self, $row, $col) = @_; |
261 | my ($self, $row, $col) = @_; |
262 | my $line = $self->line ($row); |
262 | my $line = $self->line ($row); |
263 | my $text = $line->t; |
263 | my $text = $line->t; |
|
|
264 | my $off = $line->offset_of ($row, $col) if $col; |
264 | |
265 | |
265 | my @matches; |
266 | my @matches; |
266 | for my $matcher (@{$self->{matchers}}) { |
267 | for my $matcher (@{$self->{matchers}}) { |
267 | my $launcher = $matcher->[1] || $self->{launcher}; |
268 | my $launcher = $matcher->[1] || $self->{launcher}; |
268 | while ($text =~ /$matcher->[0]/g) { |
269 | while ($text =~ /$matcher->[0]/g) { |
269 | my $match = substr $text, $-[0], $+[0] - $-[0]; |
270 | my $match = substr $text, $-[0], $+[0] - $-[0]; |
270 | my @begin = @-; |
271 | my @begin = @-; |
271 | my @end = @+; |
272 | my @end = @+; |
272 | my @exec; |
273 | my @exec; |
273 | |
274 | |
274 | if (!defined($col) || ($-[0] <= $col && $+[0] >= $col)) { |
275 | if (!defined($off) || ($-[0] <= $off && $+[0] >= $off)) { |
275 | if ($launcher !~ /\$/) { |
276 | if ($launcher !~ /\$/) { |
276 | @exec = ($launcher, $match); |
277 | @exec = ($launcher, $match); |
277 | } else { |
278 | } else { |
278 | # It'd be nice to just access a list like ($&,$1,$2...), |
279 | # It'd be nice to just access a list like ($&,$1,$2...), |
279 | # but alas, m//g behaves differently in list context. |
280 | # but alas, m//g behaves differently in list context. |