length padding on formatted values
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 17 Nov 2022 18:23:12 +0000 (19:23 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 21 Nov 2022 16:02:50 +0000 (17:02 +0100)
barcat
t/t1421-sexy_time_--sexagesimal.out

diff --git a/barcat b/barcat
index 426053ecce2f864fe5bc8144e538761677657431..061b256a10b2cdeb997f7ecac8d56c8cad3ca6ef 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -313,8 +313,9 @@ while ($nr <= $limit) {
        print $indicator if defined $indicator;
 
        if (length $val) {
-               $val = $opt{'value-format'} ? $opt{'value-format'}->($val) :
-                       sprintf "%*s", $lenval, $val;
+               $val = sprintf("%*s", $lenval,
+                       $opt{'value-format'} ? $opt{'value-format'}->($val) : $val
+               );
                color($color) for $val;
        }
        my $line = $lines[$nr] =~ s/\n/$val/r;
index dfe88d94d483d4b8db1866fdf50e823f5cfd8134..778c59895ad2b4ae05525dce6431fb7509122cbd 100644 (file)
@@ -1,11 +1,11 @@
-0:00:00 
-0:00:01 
-0:00:01 
-0:01:00 
-0:01:00 
-1:00:00 +
-1:01:01 +
-9:59:59 +----=----->-
+ 0:00:00 
+ 0:00:01 
+ 0:00:01 
+ 0:01:00 
+ 0:01:00 
+ 1:00:00 +
+ 1:01:01 +
+ 9:59:59 +----=----->-
 10:00:00 +----=----->-
 11:11:11 +----=----->--
 24:00:00 +----=----->-------------------