From aa5f3048ba30a813978d33bdee09551e482bd13f Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 4 Sep 2019 23:55:58 +0200 Subject: [PATCH] omit abbreviation mark on --trim=1 The first character should be whitespace or another delimiter to be kept. Contents can be assumed cut and does not need an indicator. --- graph | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/graph b/graph index 781af21..a764afd 100755 --- a/graph +++ b/graph @@ -26,7 +26,8 @@ my @values = map { s/^\h* ( -? [0-9]* (?:\.[0-9]+)? )//x and $1 } @lines; my @order = sort { $b <=> $a } grep { length } @values; if ($opt{trim}) { my $trimpos = abs $opt{trim}; - length > $trimpos and substr($_, $trimpos - 1) = '…' for @lines; + $trimpos == 1 ? ($_ = substr($_, 0, 1)) : + (length > $trimpos and substr($_, $trimpos - 1) = '…') for @lines; } my $maxval = $order[0]; -- 2.30.0