switch ProgressMeter to clearer API
authorespie <espie@openbsd.org>
Sat, 30 Jan 2021 10:43:43 +0000 (10:43 +0000)
committerespie <espie@openbsd.org>
Sat, 30 Jan 2021 10:43:43 +0000 (10:43 +0000)
usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm
usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm

index 8f94aea..3b0e0c9 100644 (file)
@@ -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 <espie@openbsd.org>
 #
@@ -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
index 8cb613b..01b755f 100644 (file)
@@ -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 <espie@openbsd.org>
 #
@@ -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);
index b5045d3..eb5150f 100644 (file)
@@ -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 <espie@openbsd.org>
 #
@@ -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