From 4c380a8ac4e0d944807ee58b56c6fd659ed9df90 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Tue, 30 Aug 2022 22:50:04 +0200 Subject: [PATCH] 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. --- revbank | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/revbank b/revbank index fbcfd4a..f40cbe1 100755 --- a/revbank +++ b/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];