ruderich.org/simon
/
fcscs
/
fcscs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
30ff4d3
)
fix match drawing if match group doesn't start at the beginning
author
Simon Ruderich
<simon@ruderich.org>
Sat, 23 Jan 2016 20:18:03 +0000
(21:18 +0100)
committer
Simon Ruderich
<simon@ruderich.org>
Sat, 23 Jan 2016 20:18:03 +0000
(21:18 +0100)
Also display an error message if a regex doesn't contain a match group.
bin/fcscs
patch
|
blob
|
history
diff --git
a/bin/fcscs
b/bin/fcscs
index 0033af86f8eeb10be82aa8c27fa81ee2cb019854..abe9712ea3449e2383933df563a59064144679ee 100755
(executable)
--- a/
bin/fcscs
+++ b/
bin/fcscs
@@
-385,8
+385,11
@@
sub get_regex_matches {
my @matches;
while ($input->{string} =~ /$regex/g) {
+ my $offset = $-[1];
+ die "Match group required in regex '$regex'" if not defined $offset;
+
my ($x, $y) = input_match_offset_to_coordinates($input->{width},
- $
-[0]
);
+ $
offset
);
push @matches, { x => $x, y => $y, string => $1 };
}
return @matches;