diff options
| author | Tom Feist <shabble@metavore.org> | 2010-10-09 15:49:50 +0000 | 
|---|---|---|
| committer | Tom Feist <shabble@metavore.org> | 2010-10-09 15:49:50 +0000 | 
| commit | b39c8d2a1472f75ffeb0dd3215f65a6930373ab8 (patch) | |
| tree | 2283c66c09ff1ed96e7835eaff0765b181295012 | |
| parent | renamed prompt_replace to uberprompt (diff) | |
| download | irssi-scripts-b39c8d2a1472f75ffeb0dd3215f65a6930373ab8.tar.gz irssi-scripts-b39c8d2a1472f75ffeb0dd3215f65a6930373ab8.zip | |
actually properly fixed the escaping of stuff now.
| -rw-r--r-- | prompt_info/uberprompt.pl | 17 | 
1 files changed, 12 insertions, 5 deletions
| diff --git a/prompt_info/uberprompt.pl b/prompt_info/uberprompt.pl index c9bfcc8..0a2dc6a 100644 --- a/prompt_info/uberprompt.pl +++ b/prompt_info/uberprompt.pl @@ -61,6 +61,11 @@ sub init {      # the actual API signal.      Irssi::signal_register({'change prompt' => [qw/string/]});      Irssi::signal_add('change prompt' => \&change_prompt_sig); + +    # other scripts (specifically overlay/visual) can subscribe to +    # this event to be notified when the prompt changes. +    # arguments are new contents (string), new length (int) +    Irssi::signal_register({'prompt changed' => [qw/string int/]});  }  sub change_prompt_sig { @@ -104,7 +109,7 @@ sub uberprompt_draw {      my $window = Irssi::active_win;      # hack to produce the same defaults as prompt/prompt_empty sbars. - +    print Dumper($sb_item);      if (scalar( () = $window->items )) {          $default_prompt = '{uberprompt $[.15]itemname}';      } else { @@ -115,19 +120,21 @@ sub uberprompt_draw {      if (defined $prompt_data) {          # replace the special marker '$p' with the original prompt. -        $p_copy =~ s/\$p/$default_prompt/; +        $p_copy =~ s/\$/\$\$/g; # escape all $ symbols +        $p_copy =~ s/\\/\\\\/g; # escape backslashes. + +        $p_copy =~ s/\$\$p/$default_prompt/; +      } else {          $p_copy = $default_prompt;      } -    $p_copy =~ s/\$/\$\$/g; # escape all $ symbols -    $p_copy =~ s/\\/\\\\/g; # escape backslashes.      print "Redrawing with: $p_copy, size-only: $get_size_only" if DEBUG;      $prompt_item = $sb_item;      my $ret = $sb_item->default_handler($get_size_only, $p_copy, '', 0); - +    #Irssi::signal_emit('prompt changed',       return $ret;  } | 
