From: espie Date: Sat, 30 Jan 2021 10:43:43 +0000 (+0000) Subject: switch ProgressMeter to clearer API X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ef1b7bf136064deda6e6187d5c50cc2cd74a1678;p=openbsd switch ProgressMeter to clearer API --- diff --git a/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm index 8f94aea8507..3b0e0c9f031 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddCreateDelete.pm,v 1.48 2020/01/11 13:46:39 espie Exp $ +# $OpenBSD: AddCreateDelete.pm,v 1.49 2021/01/30 10:43:43 espie Exp $ # # Copyright (c) 2007-2014 Marc Espie # @@ -101,9 +101,15 @@ sub is_interactive sub find_window_size { - my ($state, $cont) = @_; + my $state = shift; $state->SUPER::find_window_size; - $state->{progressmeter}->compute_playfield($cont); + $state->{progressmeter}->compute_playfield; +} + +sub handle_continue +{ + my $state = shift; + $state->{progressmeter}->handle_continue; } sub confirm_defaults_to_no diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm index 8cb613b1a4e..01b755fe9a7 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: ProgressMeter.pm,v 1.49 2016/06/23 16:11:23 espie Exp $ +# $OpenBSD: ProgressMeter.pm,v 1.50 2021/01/30 10:43:43 espie Exp $ # # Copyright (c) 2010 Marc Espie # @@ -84,6 +84,12 @@ sub compute_playfield { } +sub handle_continue +{ + my $self = shift; + $self->{continued} = 1; +} + # stub class when no actual progressmeter that still prints out. package OpenBSD::ProgressMeter::Stub; our @ISA = qw(OpenBSD::ProgressMeter); diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm index b5045d32e69..eb5150f6bfc 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.40 2018/12/16 10:16:43 espie Exp $ +# $OpenBSD: Term.pm,v 1.41 2021/01/30 10:43:43 espie Exp $ # # Copyright (c) 2004-2007 Marc Espie # @@ -126,14 +126,11 @@ sub init sub compute_playfield { - my ($self, $cont) = @_; + my $self = shift; $self->{playfield} = $self->width - length($self->{header}) - 7; if ($self->{playfield} < 5) { $self->{playfield} = 0; } - if ($cont) { - $self->{continued} = 1; - } } sub set_header