diff options
-rw-r--r-- | feature-tests/complete_test.pl (renamed from history-search/complete_test.pl) | 0 | ||||
-rw-r--r-- | feature-tests/expando_test.pl (renamed from history-search/expando_test.pl) | 0 | ||||
-rw-r--r-- | feature-tests/frog_reload.pl (renamed from history-search/frog_reload.pl) | 0 | ||||
-rw-r--r-- | feature-tests/help_a.pl (renamed from history-search/help_a.pl) | 0 | ||||
-rw-r--r-- | feature-tests/help_b.pl (renamed from history-search/help_b.pl) | 0 | ||||
-rw-r--r-- | feature-tests/key_test.pl (renamed from history-search/key_test.pl) | 0 | ||||
-rw-r--r-- | feature-tests/subtest.pl (renamed from history-search/subtest.pl) | 0 | ||||
-rw-r--r-- | history-search/history_search.pl | 150 |
8 files changed, 0 insertions, 150 deletions
diff --git a/history-search/complete_test.pl b/feature-tests/complete_test.pl index a8ae485..a8ae485 100644 --- a/history-search/complete_test.pl +++ b/feature-tests/complete_test.pl diff --git a/history-search/expando_test.pl b/feature-tests/expando_test.pl index 0d5456a..0d5456a 100644 --- a/history-search/expando_test.pl +++ b/feature-tests/expando_test.pl diff --git a/history-search/frog_reload.pl b/feature-tests/frog_reload.pl index 678c87d..678c87d 100644 --- a/history-search/frog_reload.pl +++ b/feature-tests/frog_reload.pl diff --git a/history-search/help_a.pl b/feature-tests/help_a.pl index 53d902c..53d902c 100644 --- a/history-search/help_a.pl +++ b/feature-tests/help_a.pl diff --git a/history-search/help_b.pl b/feature-tests/help_b.pl index 8b57a45..8b57a45 100644 --- a/history-search/help_b.pl +++ b/feature-tests/help_b.pl diff --git a/history-search/key_test.pl b/feature-tests/key_test.pl index b16ff00..b16ff00 100644 --- a/history-search/key_test.pl +++ b/feature-tests/key_test.pl diff --git a/history-search/subtest.pl b/feature-tests/subtest.pl index fd5a9cc..fd5a9cc 100644 --- a/history-search/subtest.pl +++ b/feature-tests/subtest.pl diff --git a/history-search/history_search.pl b/history-search/history_search.pl deleted file mode 100644 index 0a2282e..0000000 --- a/history-search/history_search.pl +++ /dev/null @@ -1,150 +0,0 @@ -# Search within your typed history as you type (like ctrl-R in bash) -# Usage: -# * First do: /bind ^R /history_search -# * Then type ctrl-R and type what you're searching for - -# Copyright 2007 Wouter Coekaerts <coekie@irssi.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -use strict; -use Irssi; -use Irssi::TextUI; -use Data::Dumper; - -use vars qw($VERSION %IRSSI); -$VERSION = '1.0'; -%IRSSI = ( - authors => 'Wouter Coekaerts', - contact => 'coekie@irssi.org', - name => 'history_search', - description => 'Search within your typed history as you type (like ctrl-R in bash)', - license => 'GPLv2 or later', - url => 'http://wouter.coekaerts.be/irssi/', - changed => '04/08/07' -); - -my $prompt_append = 1; -my $prompt_content = ''; - -# create a new statusbar item - -Irssi::statusbar_item_register ( 'custom_prompt', 0, 'custom_prompt' ); - -Irssi::signal_add_last 'gui print text finished' => sub { - Irssi::statusbar_items_redraw ( 'custom_prompt' ); -}; - -Irssi::signal_register({'change prompt' => [qw/string int/]}); -Irssi::signal_add('change prompt' => \&handle_change_prompt_sig); - -sub handle_change_prompt_sig { - my ($text, $append) = @_; - print "sig args: ", Dumper(\@_); - $prompt_content = $text; - $prompt_append = $append; - print "text: $prompt_content, append: $prompt_append"; - - Irssi::statusbar_items_redraw('custom_prompt'); -} - -# TODO: make these work wiht subcommand (runsub) - -Irssi::command_bind('set_prompt' => \&dothing ); -Irssi::command_set_options('set_prompt', '+string @append'); - -Irssi::command_bind('install_prompt' => \&install_prompt); -Irssi::command_bind('uninstall_prompt' => \&uninstall_prompt); - -Irssi::settings_add_bool('custom_prompt', 'autoinstall_custom_prompt', 0); - -if (Irssi::settings_get_bool('autoinstall_custom_prompt')) { - install_prompt(); -} - -sub install_prompt { - Irssi::command("/statusbar prompt add -priority '-5' -alignment left" - . " -before prompt custom_prompt"); - Irssi::command("/statusbar prompt remove prompt"); - Irssi::command("/statusbar prompt remove prompt_empty"); -} - -sub uninstall_prompt { - Irssi::command("/statusbar prompt remove custom_prompt"); - Irssi::command("/statusbar prompt add -priority '-1' " - . "-before input -alignment left prompt"); - Irssi::command("/statusbar prompt add -priority '-2' " - . "-before input -alignment left prompt_empty"); -} - -sub dothing { - #my ($str, $append) = @_; - #Irssi::print("str is $str, append=$append"); - my $parsed = [Irssi::command_parse_options('set_prompt', $_[0])]; - my $args = $parsed->[0] // {}; - my $remainder = $parsed->[1] // ''; - - my ($str, $append) = ('', 1); - print Dumper $args; - if (exists ($args->{string})) { - $str = $args->{string}; - } - - if (exists($args->{append})) { - $append = $args->{append}; - } - print "append in dothing: $append"; - Irssi::signal_emit('change prompt', $str, $append); -} - -sub custom_prompt { - my ($sb_item, $get_size_only) = @_; - - my ($width, $padChar, $padNum, $length); - - #my $prompt_str = '%K[%W$tag%c/%K$cumode%n$*%K]%n '; - - my $theme = Irssi::current_theme; - my $prompt = ''; - - my $var = ''; - if (window_is_empty(Irssi::active_win)) { - $var = 'winname'; - } else { - $var = '[.15]itemname'; - } - - if ($prompt_append) { - $prompt = $theme->format_expand("{prompt \$$var}"); - } - - my $trailing_space = ''; - if ($prompt =~ /(\s*)$/ && length $prompt_content) { - $trailing_space = $1; - } - - $prompt .= $prompt_content . $trailing_space; - $sb_item->default_handler($get_size_only, $prompt, undef, 1); -} - -sub window_is_empty { - my $window = shift; - return $window->{name} eq $window->get_active_name; -} - -sub UNLOAD { - print Dumper(\@_); - uninstall_prompt(); -} |