diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Reply/Plugin/FancyPrompt.pm | 5 | ||||
-rw-r--r-- | lib/Reply/Plugin/Nopaste.pm | 5 |
2 files changed, 8 insertions, 2 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; } diff --git a/lib/Reply/Plugin/Nopaste.pm b/lib/Reply/Plugin/Nopaste.pm index 566c668..7265dc9 100644 --- a/lib/Reply/Plugin/Nopaste.pm +++ b/lib/Reply/Plugin/Nopaste.pm @@ -76,7 +76,10 @@ sub loop { my $line = delete $self->{line}; my $result = delete $self->{result}; - $self->{history} .= "$prompt$line$result"; + $self->{history} .= "$prompt$line$result" + if defined $prompt + && defined $line + && defined $result; $continue; } |