+ } elsif ($diff &&
+ $$lines[$x] =~ /^--- ./o &&
+ $$lines[$x+1] =~ /^\+\+\+ ./o &&
+ $$lines[$x+2] =~ /^@@ -[0-9]+,([0-9]+) \+[0-9]+,([0-9]+) @@/o
+ ) {
+ # Detect and protect unified diffs.
+ # Proceed only as far as the diff should go.
+ my $minus = $1;
+ my $plus = $2;
+ $vrb[$x++] = 1;
+ $vrb[$x++] = 1;
+ $vrb[$x++] = 1;
+ for (my $cminus = 0, my $cplus = 0;
+ $cminus<=$minus && $cplus<=$plus && $x<$#$lines;
+ $x++) {
+ $vrb[$x] = 1;
+ if ($$lines[$x] !~ /^\+/) { $cminus++; };
+ if ($$lines[$x] !~ /^-/) { $cplus++; };
+ }
+ $x-=1;