idle: suspend beeping on text input (cursor move)

This commit is contained in:
Juerd Waalboer 2024-11-27 02:48:18 +01:00
parent 5f95076af8
commit 3b6f11f0dd
3 changed files with 20 additions and 6 deletions

View file

@ -1,13 +1,19 @@
#!perl
my $timeout = 10;
my $text_displayed = 0;
sub hook_prompt($class, $cart, $prompt, @) {
$text_displayed = 0;
}
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
return if $text_displayed;
$text_displayed = 1;
my $text = $readline->copy_text;
my $point = $readline->{point};