summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/FancyPrompt.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-06-08 12:06:49 -0500
committerJesse Luehrs <doy@tozt.net>2013-06-08 12:06:49 -0500
commitdc7244fa1625a30fde2641b1d86ca42e87852866 (patch)
treea07c93dce8e0d0bc11422a3330a46af68b645926 /lib/Reply/Plugin/FancyPrompt.pm
parentf4775be782ef0cd1003190169b539b3ba2367292 (diff)
downloadreply-dc7244fa1625a30fde2641b1d86ca42e87852866.tar.gz
reply-dc7244fa1625a30fde2641b1d86ca42e87852866.zip
make sure plugins can handle not going through read_line
Diffstat (limited to 'lib/Reply/Plugin/FancyPrompt.pm')
-rw-r--r--lib/Reply/Plugin/FancyPrompt.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Reply/Plugin/FancyPrompt.pm b/lib/Reply/Plugin/FancyPrompt.pm
index 1f36d45..7a0d415 100644
--- a/lib/Reply/Plugin/FancyPrompt.pm
+++ b/lib/Reply/Plugin/FancyPrompt.pm
@@ -22,19 +22,22 @@ sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->{counter} = 0;
+ $self->{prompted} = 0;
return $self;
}
sub prompt {
my $self = shift;
my ($next) = @_;
+ $self->{prompted} = 1;
return $self->{counter} . $next->();
}
sub loop {
my $self = shift;
my ($continue) = @_;
- $self->{counter}++;
+ $self->{counter}++ if $self->{prompted};
+ $self->{prompted} = 0;
$continue;
}