X-Git-Url: http://git.shiar.net/barcat.git/blobdiff_plain/74647c23b10e33a184bf448c34a7270913c353e5..016754c22c9ea37f25857c0ded629b053de34a35:/barcat diff --git a/barcat b/barcat index 88dc55c..0d843c1 100755 --- a/barcat +++ b/barcat @@ -122,6 +122,7 @@ $opt{'value-length'} = 1 if $opt{unmodified}; $opt{'signal-stat'} //= exists $SIG{INFO} ? 'INFO' : 'QUIT'; $opt{markers} //= '=avg >31.73v <68.27v +50v |0'; $opt{palette} //= $opt{color} && [31, 90, 32]; +$opt{hidemin} = ($opt{hidemin} || 1) - 1; $opt{input} = @ARGV && $ARGV[0] =~ m/\A[-0-9]/ ? \@ARGV : undef and undef $opt{interval}; @@ -191,7 +192,7 @@ sub sival { sub show_lines { -state $nr = $opt{hidemin} ? $opt{hidemin} - 1 : 0; +state $nr = $opt{hidemin}; @lines and @lines > $nr or return; @lines or return; @lines > $nr or return unless $opt{hidemin}; @@ -294,9 +295,9 @@ say $opt{palette} ? color(0) : '' if $opt{spark}; sub show_stat { if ($opt{hidemin} or $opt{hidemax}) { - $opt{hidemin} ||= 1; - $opt{hidemax} ||= @lines; - printf '%s of ', sum(grep {length} @values[$opt{hidemin} - 1 .. $opt{hidemax} - 1]) // 0; + printf '%s of ', sum(grep { length } + @values[$opt{hidemin} .. ($opt{hidemax} || @lines) - 1] + ) // 0; } if (@order) { my $total = sum @order;