aboutsummaryrefslogtreecommitdiffstats
path: root/prompt_info/uberprompt.pl
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2010-10-15 19:22:01 +0000
committerTom Feist <shabble@metavore.org>2010-10-15 19:22:01 +0000
commit629aa2beaad21c319b5010e6f705a28f45487866 (patch)
treec782f02a8ba14b8713a79703227a15217423d82f /prompt_info/uberprompt.pl
parentvisual: moved term size out of visual into overlay (diff)
downloadirssi-scripts-629aa2beaad21c319b5010e6f705a28f45487866.tar.gz
irssi-scripts-629aa2beaad21c319b5010e6f705a28f45487866.zip
uberprompt: fix to allow { and } characters in input.
% still pending - ideally te job of the sender to deal with it, or colour features can't be used.
Diffstat (limited to 'prompt_info/uberprompt.pl')
-rw-r--r--prompt_info/uberprompt.pl18
1 files changed, 17 insertions, 1 deletions
diff --git a/prompt_info/uberprompt.pl b/prompt_info/uberprompt.pl
index 7b3e022..ded45cf 100644
--- a/prompt_info/uberprompt.pl
+++ b/prompt_info/uberprompt.pl
@@ -153,14 +153,25 @@ sub prompt_subcmd_handler {
}
sub UNLOAD {
+ deinit();
+}
+
+sub exp_lbrace { '{' }
+sub exp_rbrace { '}' }
+
+sub deinit {
+ Irssi::expando_destroy('brace');
# remove uberprompt and return the original ones.
print "Removing uberprompt and restoring original";
restore_prompt_items();
}
-
sub init {
Irssi::statusbar_item_register('uberprompt', 0, 'uberprompt_draw');
+ # TODO: flags to prevent these from being recomputed?
+ Irssi::expando_create('lbrace', \&exp_lbrace, {});
+ Irssi::expando_create('rbrace', \&exp_rbrace, {});
+
Irssi::settings_add_str('uberprompt', 'uberprompt_format', '[$*$uber] ');
Irssi::settings_add_bool('uberprompt', 'uberprompt_debug', 0);
Irssi::settings_add_bool('uberprompt', 'uberprompt_autostart', 1);
@@ -255,6 +266,10 @@ sub _escape_prompt_special {
my $str = shift;
$str =~ s/\$/\$\$/g;
$str =~ s/\\/\\\\/g;
+ #$str =~ s/%/%%/g;
+ $str =~ s/{/\$lbrace/g;
+ $str =~ s/}/\$rbrace/g;
+
return $str;
}
@@ -292,6 +307,7 @@ sub uberprompt_draw {
$prompt = $pdata_copy;
} elsif ($prompt_data_pos eq 'UP_INNER' && defined $prompt_data) {
+
my $esc = _escape_prompt_special($prompt_data);
$prompt =~ s/\$\$uber/$esc/;