From b6008b33538e96716798d7079a7e6aaaf90fe738 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sat, 24 Jul 2010 18:23:55 +0100 Subject: moved prompt_info to its own subdir --- history-search/prompt_info.pl | 77 ------------------------------------------- prompt_info/prompt_info.pl | 77 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 77 deletions(-) delete mode 100644 history-search/prompt_info.pl create mode 100644 prompt_info/prompt_info.pl diff --git a/history-search/prompt_info.pl b/history-search/prompt_info.pl deleted file mode 100644 index ad5321b..0000000 --- a/history-search/prompt_info.pl +++ /dev/null @@ -1,77 +0,0 @@ -# Usage: - -# edit your theme, find the line beginning: -# -# prompt = "..." -# -# and add the string `$prompt_additional' somewhere inside it. -# If using the default: prompt = "[$*] ", then a good value would be: -# -# prompt = "[$*$prompt_additional] " -# -# Then add this script to your autorun directory (~/.irssi/scripts/autorun/) -# -# You can modify your prompt content by using the '/set_prompt ' command, -# or from scripts by Irssi:signal_emit('change prompt', $string); - -use strict; -use warnings; - -use Irssi; -use Irssi::TextUI; # for sbar_items_redraw - -use vars qw($VERSION %IRSSI); -$VERSION = "1.0.1"; -%IRSSI = - ( - authors => "shabble", - contact => 'shabble+irssi@metavore.org, shabble@#irssi/Freenode', - name => "prompt_info", - description => "Helper script for dynamically adding text " - . "into the input-bar prompt.", - license => "Public Domain", - changed => "24/7/2010" - ); - -sub DEBUG () { 0 } - -my $prompt_additional_content = ''; - -Irssi::expando_create('prompt_additional', \&expando_prompt, {}); - -sub expando_prompt { - my ($server, $witem, $arg) = @_; - return $prompt_additional_content; -} - -sub redraw_prompts { - Irssi::statusbar_items_redraw ('prompt'); - Irssi::statusbar_items_redraw ('prompt_empty'); -} - -sub handle_change_prompt_sig { - my ($text) = @_; - - print "Got prompt change sig with: $text" if DEBUG; - - my $expanded_text = Irssi::parse_special($text); - my $changed = ($expanded_text ne $prompt_additional_content); - - $prompt_additional_content = $expanded_text; - - if ($changed) { - print "Redrawing prompts" if DEBUG; - redraw_prompts(); - } -} - -sub prompt_additional_cmd { - my ($str) = @_; - print "Setting prompt to: $str" if DEBUG; - Irssi::signal_emit('change prompt', $str); -} - -Irssi::signal_register({'change prompt' => [qw/string/]}); -Irssi::signal_add('change prompt' => \&handle_change_prompt_sig); - -Irssi::command_bind('set_prompt' => \&prompt_additional_cmd); diff --git a/prompt_info/prompt_info.pl b/prompt_info/prompt_info.pl new file mode 100644 index 0000000..ad5321b --- /dev/null +++ b/prompt_info/prompt_info.pl @@ -0,0 +1,77 @@ +# Usage: + +# edit your theme, find the line beginning: +# +# prompt = "..." +# +# and add the string `$prompt_additional' somewhere inside it. +# If using the default: prompt = "[$*] ", then a good value would be: +# +# prompt = "[$*$prompt_additional] " +# +# Then add this script to your autorun directory (~/.irssi/scripts/autorun/) +# +# You can modify your prompt content by using the '/set_prompt ' command, +# or from scripts by Irssi:signal_emit('change prompt', $string); + +use strict; +use warnings; + +use Irssi; +use Irssi::TextUI; # for sbar_items_redraw + +use vars qw($VERSION %IRSSI); +$VERSION = "1.0.1"; +%IRSSI = + ( + authors => "shabble", + contact => 'shabble+irssi@metavore.org, shabble@#irssi/Freenode', + name => "prompt_info", + description => "Helper script for dynamically adding text " + . "into the input-bar prompt.", + license => "Public Domain", + changed => "24/7/2010" + ); + +sub DEBUG () { 0 } + +my $prompt_additional_content = ''; + +Irssi::expando_create('prompt_additional', \&expando_prompt, {}); + +sub expando_prompt { + my ($server, $witem, $arg) = @_; + return $prompt_additional_content; +} + +sub redraw_prompts { + Irssi::statusbar_items_redraw ('prompt'); + Irssi::statusbar_items_redraw ('prompt_empty'); +} + +sub handle_change_prompt_sig { + my ($text) = @_; + + print "Got prompt change sig with: $text" if DEBUG; + + my $expanded_text = Irssi::parse_special($text); + my $changed = ($expanded_text ne $prompt_additional_content); + + $prompt_additional_content = $expanded_text; + + if ($changed) { + print "Redrawing prompts" if DEBUG; + redraw_prompts(); + } +} + +sub prompt_additional_cmd { + my ($str) = @_; + print "Setting prompt to: $str" if DEBUG; + Irssi::signal_emit('change prompt', $str); +} + +Irssi::signal_register({'change prompt' => [qw/string/]}); +Irssi::signal_add('change prompt' => \&handle_change_prompt_sig); + +Irssi::command_bind('set_prompt' => \&prompt_additional_cmd); -- cgit v1.2.3