revbank/plugins/idle
Juerd Waalboer 194ba4990c idle: use underline instead of dim/faint
Was always intended as underline. Our old IBM terminal renders 2 as
underline. Other things interpret it as dim/faint though...
2023-06-10 22:24:14 +02:00

30 lines
795 B
Perl

#!perl
my $timeout = 10;
sub hook_prompt_idle($class, $cart, $plugin, $seconds, $readline, @) {
return unless $seconds >= $timeout and $cart->size and not $plugin;
call_hooks("beep");
return if $seconds > $timeout; # text only once
my $text = $readline->copy_text;
my $point = $readline->{point};
$readline->save_prompt;
$readline->replace_line("");
$readline->redisplay;
my $verb = $cart->sum < 0 ? "pay" : "finish";
my $help = $cart->entries('refuse_checkout')
? "Enter 'abort' to abort."
: "Enter username to $verb or 'abort' to abort.";
print "\e[33;4;1mTransaction incomplete.\e[0m $help\n";
$readline->restore_prompt;
$readline->replace_line($text);
$readline->{point} = $point;
$readline->redisplay;
}