]> ruderich.org/simon Gitweb - fcscs/fcscs.git/blobdiff - bin/fcscs
add missing match group in regex config example
[fcscs/fcscs.git] / bin / fcscs
index 054842aeebd915e25deedbc36a876f72655bc253..25a530207447007fd5a17ee8d3eecbcb08fe4b8f 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;
@@ -458,6 +461,9 @@ sub run_in_background {
         my $pid = fork;
         defined $pid or die $!;
         if ($pid == 0) { # child
+            # Disable debug mode as writing will fail with closed STDERR.
+            $config->{setting}{debug} = 0;
+
             $sub->();
         }
         exit;
@@ -952,7 +958,7 @@ my %setting = (
 Example:
 
     # Select all non-whitespace characters when searching for paths.
-    $config{regex}{path} = qr{\S+};
+    $config{regex}{path} = qr{(\S+)};
 
 =cut
 my %regex = (