From a00384bb0eacec5761e6484cab968b5be9136aaa Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Sat, 10 Jun 2023 22:22:37 +0200 Subject: [PATCH] statiegeld: repeat color code on 2nd line of prompt Found in interaction with `idle` plugin, which causes redraw. --- plugins/statiegeld | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/statiegeld b/plugins/statiegeld index 7b4abe7..f7c535b 100644 --- a/plugins/statiegeld +++ b/plugins/statiegeld @@ -108,14 +108,14 @@ sub hook_added_entry ($class, $cart, $entry, @) { sub hook_prompt { # ($class, $cart, $prompt), but via @_ for mutable alias $S or return; - my $m = "Scan empty container for deposit return."; + my $message = "Scan empty container for deposit return."; # The message is prepended to the prompt, so it is printed after - # clear-screen (^L). - # ignore-------end ignore----end - # yellow----------------reset - my $statiegeld_prompt = "\x01\e[33;1m\x02$m\n+>\x01\e[0m\x02"; - # Actual text: ^^^^^^ + # clear-screen (^L). The color is repeated on the second line because + # readline redraws only the last line of a multiline prompt. + my $yellow = "\x01\e[e33;1m\x02"; + my $reset = "\x01\e[m\x02"; + my $statiegeld_prompt = "$yellow$message$reset\n$yellow+>$reset"; $_[2] =~ s/^$/$statiegeld_prompt/; }