From 0797e711fd25d00e42d45879c96387a5e61eecd2 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 17 Nov 2022 19:23:12 +0100 Subject: [PATCH] length padding on formatted values --- barcat | 5 +++-- t/t1421-sexy_time_--sexagesimal.out | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/barcat b/barcat index 426053e..061b256 100755 --- 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; diff --git a/t/t1421-sexy_time_--sexagesimal.out b/t/t1421-sexy_time_--sexagesimal.out index dfe88d9..778c598 100644 --- a/t/t1421-sexy_time_--sexagesimal.out +++ b/t/t1421-sexy_time_--sexagesimal.out @@ -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 +----=----->------------------- -- 2.30.0