apply hide limits in length calculation
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 26 Nov 2022 13:21:36 +0000 (14:21 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 27 Nov 2022 21:16:26 +0000 (22:16 +0100)
barcat
t/t1503-partial.out

diff --git a/barcat b/barcat
index 431ed401489a1aa40aa9a1315966b2422734a2c5..bf38f120d4414cc26db20726060c0d89938f8b10 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -239,8 +239,8 @@ my $range = $maxval - $minval;
 $range &&= log $range if $opt{log};
 my $lenval = $opt{'value-length'} // max map { length } @order;
 my $len    = defined $opt{trim} && $opt{trim} <= 0 ? -$opt{trim} + 1 :
-       max map { length $values[$_] && length $lines[$_] }
-               0 .. min $#lines, $opt{hidemax} || ();  # left padding
+       max(map { length $values[$_] && length $lines[$_] } $nr .. $limit)
+       // 0;  # left padding
 my $size   = defined $opt{width} && $range &&
        ($opt{width} - $lenval - $len - !!$opt{indicators});  # bar multiplication
 
index 2f913c50b38dd6929eda49c5e3809f7749d9cfd1..d3965d7d41b40a7126b2ec1d48234bfa07f60553 100644 (file)
@@ -1,3 +1,3 @@
 barcat -L1-2 input/aligned.txt
-  1           -------------
-  2 prepend   --------------------------
+  1         --------------
+  2 prepend ----------------------------