diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-06-05 12:27:14 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-06-05 12:27:14 +0000 |
commit | 871118f77548e68a5ab21cea19cbbaf610da7131 (patch) | |
tree | c86eebe77e09642a5eb96d6c76232eab84c90bde /usr.sbin | |
parent | 44a26200b68b16ae2449fb346e09dd6da54302db (diff) |
be more specific as to what we keep. Less flicker in working
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm index 5ea68ee23e0..b9c0640360e 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Term.pm,v 1.5 2010/06/05 12:01:08 espie Exp $ +# $OpenBSD: Term.pm,v 1.6 2010/06/05 12:27:13 espie Exp $ # # Copyright (c) 2004-2007 Marc Espie <espie@openbsd.org> # @@ -144,8 +144,10 @@ sub _show { my ($self, $extra, $stars) = @_; my $d = $self->{header}; + my $prefix = length($d); if (defined $extra) { $d.="|$extra"; + $prefix++; } return if $d eq $self->{lastdisplay} && !$self->{continued}; if ($self->{width} > length($d)) { @@ -155,15 +157,12 @@ sub _show $d .= ' 'x($self->{width} - length($d) - 1); } } - my $prefix; if (!$self->{continued} && defined $self->{hpa}) { if (defined $stars && defined $self->{stars}) { - $prefix = length($self->{header})+1+$self->{stars}; - } else { - $prefix = length($self->{header}); + $prefix += $self->{stars}; } } - if (defined $prefix && substr($self->{lastdisplay}, 0, $prefix) eq + if (substr($self->{lastdisplay}, 0, $prefix) eq substr($d, 0, $prefix)) { print $self->hmove($prefix), substr($d, $prefix); } else { @@ -210,6 +209,7 @@ sub working { my ($self, $slowdown) = @_; $self->{work}++; + return if $self->{work} < $slowdown; $self->message(substr("/-\\|", ($self->{work}/$slowdown) % 4, 1)); } sub clear |