diff options
author | Tom Feist <shabble@metavore.org> | 2010-11-24 17:53:00 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2010-11-24 17:53:00 +0000 |
commit | 61849414590f1aef81e4fa5537d27c11206cd00d (patch) | |
tree | 40745d8571ecddb4802907788cf098bb42aa3952 /prompt_info | |
parent | vim_mode: mapped Irssi commands only use $server context if it is available. (diff) | |
download | irssi-scripts-61849414590f1aef81e4fa5537d27c11206cd00d.tar.gz irssi-scripts-61849414590f1aef81e4fa5537d27c11206cd00d.zip |
uberprompt: now updates correctly for some additional expandos, such as $tag
Diffstat (limited to 'prompt_info')
-rw-r--r-- | prompt_info/uberprompt.pl | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/prompt_info/uberprompt.pl b/prompt_info/uberprompt.pl index 9aa75b8..7bb03a2 100644 --- a/prompt_info/uberprompt.pl +++ b/prompt_info/uberprompt.pl @@ -145,6 +145,9 @@ my $use_replaces = 0; my $emit_request = 0; +my $expando_refresh_timer; +my $expando_vars = {}; + pre_init(); sub pre_init { @@ -205,10 +208,12 @@ sub init { reload_settings(); # make sure we redraw when necessary. - Irssi::signal_add('window changed', \&uberprompt_refresh); - Irssi::signal_add('window name changed', \&uberprompt_refresh); - Irssi::signal_add('window changed automatic', \&uberprompt_refresh); - Irssi::signal_add('window item changed', \&uberprompt_refresh); + Irssi::signal_add('window changed', \&uberprompt_refresh); + Irssi::signal_add('window name changed', \&uberprompt_refresh); + Irssi::signal_add('window changed automatic', \&uberprompt_refresh); + Irssi::signal_add('window item changed', \&uberprompt_refresh); + Irssi::signal_add('window item server changed', \&uberprompt_refresh); + Irssi::signal_add('window server changed', \&uberprompt_refresh); # install our statusbars if required. if (Irssi::settings_get_bool('uberprompt_autostart')) { @@ -252,6 +257,17 @@ sub reload_settings { $prompt_format = $new; $prompt_format =~ s/\$uber/\$\$uber/; Irssi::abstracts_register(['uberprompt', $prompt_format]); + + $expando_vars = {}; + + # TODO: something clever here to check if we need to schedule + # an update timer or something, rather than just refreshing on + # every possible activity in init() + while ($prompt_format =~ m/(?<!\$)(\$[A-Za-z,.:;][a-z_]*)/g) { + print "Detected Irssi expando variable $1" if DEBUG; + my $var_name = substr $1, 1; # strip the $ + $expando_vars->{$var_name} = Irssi::parse_special($1); + } } } |