Allow hook_prompt to mutate the prompt, like before, and use that

This functionality was accidentally broken by eed0db78

Also: ignore readline terminal sequence (\x01...\x02) in detection of ">"
This commit is contained in:
Juerd Waalboer 2023-01-19 02:28:34 +01:00
parent 5e91aaff3d
commit 16d530ae16
3 changed files with 16 additions and 7 deletions

View file

@ -18,11 +18,13 @@ sub _read_file($fn) {
readline *ARGV;
}
sub call_hooks($hook, @args) {
sub call_hooks {
my $hook = shift;
my $method = "hook_$hook";
for my $class (@plugins) {
if ($class->can($method)) {
my ($rv, @message) = $class->$method(@args);
my ($rv, @message) = $class->$method(@_);
if (defined $rv and ref $rv) {
main::abort(@message) if $rv == ABORT;