Fix bug in REJECT handling
Next input would not be split. > withdraw 1 Pending: 1.00 Withdrawal Enter username to deduct 1.00 from your account; type 'abort' to abort. > undo Undo is not available mid-transaction. Enter 'abort' to abort. > undo 123 undo 123: No such product, user, or command. Of course, "undo 123" as top-level input should have been split on whitespace. Top-level input is handled by the 'command' method, so that should be a reliable way to detect that the prompt is a top-level prompt, rather than a follow-up prompt. Keeping an additional global boolean was a dumb approach anyway.
This commit is contained in:
parent
13e3435d33
commit
4c380a8ac4
1 changed files with 1 additions and 3 deletions
4
revbank
4
revbank
|
@ -133,7 +133,6 @@ OUTER: for (;;) {
|
|||
print "\n";
|
||||
}
|
||||
|
||||
my $split_input = 1;
|
||||
my $prompt = "";
|
||||
my @plugins = RevBank::Plugins->new;
|
||||
my $method = "command";
|
||||
|
@ -157,6 +156,7 @@ OUTER: for (;;) {
|
|||
}
|
||||
|
||||
call_hooks "prompt", $cart, $prompt;
|
||||
my $split_input = !ref($method) && $method eq 'command';
|
||||
|
||||
my %completions = qw(abort 1);
|
||||
for my $plugin (@plugins) {
|
||||
|
@ -195,7 +195,6 @@ OUTER: for (;;) {
|
|||
|
||||
my $word = shift @words;
|
||||
push @retry, $word;
|
||||
$split_input = 0; # Only split 'outer' input.
|
||||
|
||||
PLUGIN: for my $plugin (@plugins) {
|
||||
my ($rv, @rvargs) = eval { $plugin->$method($cart, $word) };
|
||||
|
@ -223,7 +222,6 @@ OUTER: for (;;) {
|
|||
if ($rv == REJECT) {
|
||||
my ($reason) = @rvargs;
|
||||
#abort if @words;
|
||||
|
||||
if (@words) {
|
||||
call_hooks "retry", $plugin->id, $reason, @words ? 1 : 0;
|
||||
push @retry, [@words];
|
||||
|
|
Loading…
Add table
Reference in a new issue