Don't truncate lines if an error occurred.

This commit is contained in:
Dag-Erling Smørgrav 2003-01-18 12:15:34 +00:00
parent ea54c2afef
commit 991a7df22b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109485

View File

@ -18,6 +18,7 @@ my @lines = ();
my $thresh = 10;
my $lastwasdash = 0;
my $width = $ENV{COLUMNS} || 80;
my $error = 0;
my $elided = 0;
while ($line = <>) {
@ -36,25 +37,29 @@ while ($line = <>) {
if ($line =~ /^=+>/) {
@lines = ();
}
if (length($line) >= $width) {
substr($line, $width - 7) = " [...]\n";
}
push(@lines, $line);
if ($line =~ /^\*\*\* Error/ && $line !~ /\(ignored\)/) {
print @lines;
$error = 1;
while ($line = <>) {
print $line;
push(@lines, $line);
}
exit;
last;
}
}
print shift(@lines);
while (@lines > $thresh) {
shift(@lines);
++$elided;
if (!$error) {
print shift(@lines);
while (@lines > $thresh) {
shift(@lines);
++$elided;
}
if ($elided > 0) {
print "[$elided lines elided]\n";
}
}
if ($elided > 0) {
print "[$elided lines elided]\n";
foreach $line (@lines) {
if (!$error && length($line) >= $width) {
substr($line, $width - 7) = " [...]\n";
}
print $line;
}
print @lines;