diff options
| -rwxr-xr-x | docs/buildpod.pl | 4 | ||||
| -rw-r--r-- | feature-tests/subscript.pl | 98 | ||||
| -rw-r--r-- | feature-tests/test.sub | 7 | ||||
| -rw-r--r-- | history-search/rl_history_search.pl | 63 | ||||
| -rw-r--r-- | prompt_info/uberprompt.pl | 214 | ||||
| -rw-r--r-- | scrolled-reminder/scrolled_reminder.pl | 89 | 
6 files changed, 369 insertions, 106 deletions
| diff --git a/docs/buildpod.pl b/docs/buildpod.pl index dfddf54..debaa3b 100755 --- a/docs/buildpod.pl +++ b/docs/buildpod.pl @@ -32,7 +32,7 @@ sub new {                          q(find something obviously wrong, or have requests ),                          q(for further documentation on topics not yet ),                          q(filled out, please ), -                        q(<a href="http://github.com/shabble/shab-irssi-scripts/issues#">create an issue</a>), +                        q(<a href="http://github.com/shabble/irssi-scripts/issues#">create an issue</a>),                          " on my Github page, and I'll see what I can do.</b></p>",                         ); @@ -90,7 +90,7 @@ package main;  use File::Copy; -my $output_dir = "../../tmp/shab-irssi-scripts/docs/"; +my $output_dir = "../../tmp/irssi-scripts/docs/";  my $batchconv = Pod::Simple::HTMLBatch::Custom->new;  my $css = 'podstyle.css'; diff --git a/feature-tests/subscript.pl b/feature-tests/subscript.pl new file mode 100644 index 0000000..8550409 --- /dev/null +++ b/feature-tests/subscript.pl @@ -0,0 +1,98 @@ +use strict; +use Irssi; +use Irssi::TextUI; # for sbar_items_redraw + +use vars qw($VERSION %IRSSI); + +$VERSION = "0.1"; + +%IRSSI = ( +	authors         => "shabble", +	contact         => 'shabble+irssi@metavore.org, shabble@#irssi/Freenode', +	name            => "", +	description     => "", +	license         => "Public Domain", +	changed         => "" +); + +my $functions = {}; + +init(); + +sub _input { +    return int rand 1000; +} + +sub load { +    my $file = shift; +    my $funcs; +    if (-f $file) { +        print "Loading from file: $file"; +        $funcs = do $file; +    } +    if (not defined $funcs) { +        if ($@) { +            print "failed to parse $file: $@"; + +        } elsif ($!) { +            print "failed to read $file: $!"; + +        } +        return; +    } +    my $ref = ref $funcs; +    if ($ref ne 'HASH') { +        print "$file didn't return a hashref: ", defined $ref ? $ref : 'undef'; +        return; +    } + +    foreach my $name (keys %$funcs) { +        my $func = $funcs->{$name}; +        if (exists $functions->{$name}) { +            print "Redefining function $name"; +        } else { +            print "adding function: $name"; +        } +        $functions->{$name} = $func; +    } + +    print "Loaded " . scalar(keys(%$funcs)) . " functions"; +} + +sub init { +    Irssi::command_bind('subload', \&cmd_subload); +    Irssi::command_bind('sublist', \&cmd_sublist); +    Irssi::command_bind('subcall', \&cmd_subcall); +} + +sub cmd_subload { +    my $args = shift; +    print "Going to load: $args"; +    load($args); +} + +sub cmd_sublist { +    foreach my $name (keys %$functions) { +        my $func = $functions->{$name}; +        print "Function: $name => $func"; +    } +} + +sub cmd_subcall { +    my $args = shift; +    my ($cmd, $cmdargs); +    if ($args =~ m/^(\w+\b)(.*)$/) { +        $cmd = $1; $cmdargs = $2; +    } else { +        print "Couldn't parse $args"; +        return; +    } +    my $fun = $functions->{$cmd}; + +    if (ref $fun eq 'CODE') { +        print "Calling $cmd with $cmdargs"; +        $fun->($cmdargs); +    } else { +        print "$cmd is not a coderef. cannot run"; +    } +} diff --git a/feature-tests/test.sub b/feature-tests/test.sub new file mode 100644 index 0000000..350e89d --- /dev/null +++ b/feature-tests/test.sub @@ -0,0 +1,7 @@ +{ +    'moo' => sub { print "Moo" }, +    'hello' => sub { print join(", ", @_) }, +    'inp' => sub { print "input is : ", _input(); }, +}; + + diff --git a/history-search/rl_history_search.pl b/history-search/rl_history_search.pl index 83ff934..eebb6c7 100644 --- a/history-search/rl_history_search.pl +++ b/history-search/rl_history_search.pl @@ -1,29 +1,39 @@  # Search within your typed history as you type (like ctrl-R in bash) -# Usage: - +# +# INSTALL: +# +# This script requires that you have first installed and loaded 'uberprompt.pl' +# Uberprompt can be downloaded from: +# +# http://github.com/shabble/irssi-scripts/raw/master/prompt_info/uberprompt.pl +# +# and follow the instructions at the top of that file for installation. +# +# USAGE: +#  # * Setup: /bind ^R /history_search_start - +#  # * Then type ctrl-R and type what you're searching for - +#  # * You can cycle through multiple matches with ^R (older matches), and  #   ^S (newer matches) - +#  # NOTE: Ctrl-S may not work if you have software flow control configured for  # your terminal. It may appear to freeze irssi entirely. If this happens, it can  # be restored with Ctrl-Q, but you will be unable to use the Ctrl-S binding.  # You can disable flow control by running the command `stty -ixon' in your  # terminal, or setting `defflow off' in your ~/.screenrc if using GNU Screen. - +#  # * Hitting enter selects a match and terminates search mode. - +#  # * You can use ^G to exit search mode without selecting. - +#  # * Any other ctrl- or meta- key binding will terminate search mode, leaving the  #   selected item in the input line. - +#  # Original script Copyright 2007  Wouter Coekaerts <coekie@irssi.org>  # Heavy modifications by Shabble <shabble+irssi@metavore.org>, 2010. - +#  # 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 @@ -53,7 +63,7 @@ $VERSION = '1.0';     description => 'Search within your typed history as you type'                  . ' (like ctrl-R in readline applications)',     license     => 'GPLv2 or later', -   url         => 'http://github.com/shabble/shab-irssi-scripts/tree/master/history-search/', +   url         => 'http://github.com/shabble/irssi-scripts/tree/master/history-search/',     changed     => '24/7/2010'    ); @@ -65,9 +75,10 @@ my @search_matches = ();  my $match_index = 0; -sub DEBUG () { 0 } +my $DEBUG_ENABLED = 0; +sub DEBUG () { $DEBUG_ENABLED } -# check we have prompt_info loaded. +# check we have uberprompt loaded.  sub script_is_loaded {      my $name = shift; @@ -79,19 +90,29 @@ sub script_is_loaded {      return $retval;  } -unless (script_is_loaded('prompt_info')) { -    die "This script requires 'prompt_info' in order to work. " +unless (script_is_loaded('uberprompt')) { +    die "This script requires 'uberprompt.pl' in order to work. "        . "Please load it and try again";  } else {      history_init();  }  sub history_init { +    Irssi::settings_add_bool('history_search', 'histsearch_debug', 0); +      Irssi::command_bind('history_search_start', \&history_search); -    #Irssi::command_bind('history_search_exit', \&history_search_exit); + +    Irssi::signal_add      ('setup changed'   => \&setup_changed);      Irssi::signal_add_first('gui key pressed' => \&handle_keypress); + +    setup_changed();  } +sub setup_changed { +    $DEBUG_ENABLED = Irssi::settings_get_bool('histsearch_debug'); +} + +  sub history_search {      $search_active = 1;      $search_str = ''; @@ -105,16 +126,20 @@ sub history_search {  sub history_exit {      $search_active = 0; -    Irssi::signal_emit('change prompt', ''); +    Irssi::signal_emit('change prompt', '', 'UP_INNER');  }  sub update_history_prompt { -    Irssi::signal_emit('change prompt', " reverse-i-search: \`$search_str'"); +    my $col = scalar(@search_matches) ? '%g' : '%r'; +    Irssi::signal_emit('change prompt', +                       ' reverse-i-search: `' . $col . $search_str +                       . '%n' . "'", +                       'UP_INNER');  }  sub update_history_matches {      my ($match_str) = @_; -    $match_str //= $search_str; +    $match_str = $search_str unless defined $match_str;      my %unique;      my @matches = grep { m/\Q$match_str/i } @history_cache; diff --git a/prompt_info/uberprompt.pl b/prompt_info/uberprompt.pl index d5f66b2..79717ae 100644 --- a/prompt_info/uberprompt.pl +++ b/prompt_info/uberprompt.pl @@ -2,7 +2,7 @@  # of displaying additional information, under either user control or via  # scripts.  # -# Installation: +# INSTALL:  #  # Place script in ~/.irssi/scripts/ and potentially symlink into autorun/  # to ensure it starts at irssi startup. @@ -11,11 +11,16 @@  #  # /script load uberprompt.pl  # -# Usage: +# If you have a custom prompt format, you may need to copy it to the +# uberprompt_format setting. See below for details. +# +# USAGE:  #  # Although the script is designed primarily for other scripts to set  # status information into the prompt, the following commands are available:  # +# TODO: Document positional settings. +#  # /prompt set   - sets the prompt to the given argument. $p in the argument will  #                 be replaced by the original prompt content.  # /prompt clear - clears the additional data provided to the prompt. @@ -26,21 +31,43 @@  #  # Additionally, the format for the prompt can be set via:  # +# UBERPROMPT FORMAT: +#  # /set uberprompt_format <format>  #  # The default is [$*], which is the same as the default provided in default.theme.  # Changing this setting will update the prompt immediately, unlike editing your theme.  # +# An additional variable available within this format is '$uber', which expands to +# the content of prompt data provided with the UP_INNER placement argument. For all +# other placement arguments, it will expand to the empty string ''. +#  # NOTE: this setting completely overrides the prompt="..." line in your .theme  #       file, and may cause unexpected behaviour if your theme wishes to set a  #       different form of prompt. It can be simply copied from the theme file into  #       the above setting.  # -# Usage from other Scripts: +# Usage from other Scripts: signal 'change prompt' => 'string' => position +# +# eg: +# +# signal_emit 'change prompt' 'some_string', UberPrompt::UP_INNER; +# +# will set the prompt to include that content, by default '[$* some_string]' +# +# The possible position arguments are the following strings:  # -# signal_emit 'change prompt' 'some_string $p other string'; +# UP_PRE   - place the provided string before the prompt -- $string$prompt +# UP_INNER - place the provided string inside the prompt -- {prompt $* $string} +# UP_POST  - place the provided string after the prompt  -- $prompt$string +# UP_ONLY  - replace the prompt with the provided string -- $string  # -# will set the prompt to include that content. +# All strings may use the special variable '$prompt' to include the prompt +# verbatim at that position in the string.  It is probably only useful for +# the UP_ONLY mode however. '$prompt_nt' will include the prompt, minus any +# trailing whitespace. +# +# NOTIFICATIONS:  #  # You can also be notified when the prompt changes in response to the previous  # signal or manual commands via: @@ -75,7 +102,6 @@  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  # THE SOFTWARE. -  use strict;  use warnings; @@ -83,8 +109,6 @@ use Irssi;  use Irssi::TextUI;              # for sbar_items_redraw  use Data::Dumper; - -  our $VERSION = "0.2";  our %IRSSI =    ( @@ -99,136 +123,189 @@ our %IRSSI =  my $DEBUG_ENABLED = 0; -  sub DEBUG { $DEBUG_ENABLED } -my $prompt_data = undef; +my $prompt_data     = ''; +my $prompt_data_pos = 'UP_INNER'; -my $prompt_format = ''; +my $prompt_last     = ''; +my $prompt_format   = '';  init();  sub prompt_subcmd_handler {      my ($data, $server, $item) = @_; -    $data =~ s/\s+$//g; # strip trailing whitespace. +    $data =~ s/\s+$//g;         # strip trailing whitespace.      Irssi::command_runsub('prompt', $data, $server, $item);  } +sub UNLOAD { +    # 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'); -    Irssi::settings_add_str('uberprompt', 'uberprompt_format', '[$*] '); +    Irssi::settings_add_str('uberprompt', 'uberprompt_format', '[$*$uber] ');      Irssi::settings_add_bool('uberprompt', 'uberprompt_debug', 0); +    Irssi::settings_add_bool('uberprompt', 'uberprompt_autostart', 1);      Irssi::command_bind("prompt",     \&prompt_subcmd_handler);      Irssi::command_bind('prompt on',  \&replace_prompt_items);      Irssi::command_bind('prompt off', \&restore_prompt_items);      Irssi::command_bind('prompt set', -                        sub { Irssi::signal_emit 'change prompt', shift; }); +                        sub { +                            my $args = shift; +                            $args =~ s/^\s*(\w+)\s*(.*$)/$2/; +                            my $mode = 'UP_' . uc($1); +                            Irssi::signal_emit 'change prompt', $args, $mode; +                        });      Irssi::command_bind('prompt clear', -                        sub { Irssi::signal_emit 'change prompt', '$p'; }); +                        sub { +                            Irssi::signal_emit 'change prompt', '$p', 'UP_POST'; +                        });      Irssi::signal_add('setup changed', \&reload_settings);      # intialise the prompt format.      reload_settings(); -    # install our statusbars. -    replace_prompt_items(); +    # 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); + +    # install our statusbars if required. +    if (Irssi::settings_get_bool('uberprompt_autostart')) { +        replace_prompt_items(); +    } + +    # API signals -    # the actual API signal. -    Irssi::signal_register({'change prompt' => [qw/string/]}); -    Irssi::signal_add('change prompt' => \&change_prompt_sig); +    Irssi::signal_register({'change prompt' => [qw/string string/]}); +    Irssi::signal_add('change prompt' => \&change_prompt_handler);      # 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/]}); +      if (DEBUG) {          Irssi::signal_add 'prompt changed', \&debug_prompt_changed;      }  } +sub reload_settings { + +    $DEBUG_ENABLED = Irssi::settings_get_bool('uberprompt_debug'); + +    my $new = Irssi::settings_get_str('uberprompt_format'); +    if ($prompt_format ne $new) { +        print "Updated prompt format" if DEBUG; +        $prompt_format = $new; +        $prompt_format =~ s/\$uber/\$\$uber/; +        Irssi::abstracts_register(['uberprompt', $prompt_format]); +    } +} +  sub debug_prompt_changed {      my ($text, $len) = @_; -    my $exp = Irssi::current_theme()->format_expand($text, 0); -    my $ps = Irssi::parse_special($exp); -    print "DEBUG: Got $text = $exp = $ps, length: $len"; + +    $text =~ s/%/%%/g; + +    print "DEBUG: Got $text, length: $len";  } -sub change_prompt_sig { -    my ($text) = @_; +sub change_prompt_handler { +    my ($text, $pos) = @_; -    # TODO: mroe intelligence about where to insert $p? -    $text = '$p' . $text; -    print "Got prompt change sig with: $text" if DEBUG; +    print "Got prompt change signal with: $text, $pos" if DEBUG; -    my $changed; -    $changed = defined $prompt_data ? $prompt_data ne $text : 1; +    my ($changed_text, $changed_pos); +    $changed_text = defined $prompt_data     ? $prompt_data     ne $text : 1; +    $changed_pos  = defined $prompt_data_pos ? $prompt_data_pos ne $pos  : 1; -    $prompt_data = $text; +    $prompt_data     = $text; +    $prompt_data_pos = $pos; -    if ($changed) { +    if ($changed_text || $changed_pos) {          print "Redrawing prompt" if DEBUG;          uberprompt_refresh();      }  } -sub UNLOAD { -    # remove uberprompt and return the original ones. -    print "Removing uberprompt and restoring original"; -    restore_prompt_items(); -} - -sub reload_settings { - -    $DEBUG_ENABLED = Irssi::settings_get_bool('uberprompt_debug'); - -    my $new = Irssi::settings_get_str('uberprompt_format'); -    if ($prompt_format ne $new) { -        print "Updated prompt format" if DEBUG; -        $prompt_format = $new; -        Irssi::abstracts_register(['uberprompt', $prompt_format]); -    } +sub _escape_prompt_special { +    my $str = shift; +    $str =~ s/\$/\$\$/g; +    $str =~ s/\\/\\\\/g; +    return $str;  }  sub uberprompt_draw {      my ($sb_item, $get_size_only) = @_; -    my $default_prompt = ''; -      my $window = Irssi::active_win; +    my $prompt_arg = ''; -    #print Dumper($sb_item); - -    # hack to produce the same defaults as prompt/prompt_empty sbars. +    # default prompt sbar arguments (from config)      if (scalar( () = $window->items )) { -        $default_prompt = '{uberprompt $[.15]itemname}'; +        $prompt_arg = '$[.15]{itemname}';      } else { -        $default_prompt = '{uberprompt $winname}'; +        $prompt_arg = '${winname}';      } -    my $p_copy = $prompt_data; +    my $prompt = '';            # rendered content of the prompt. +    my $theme = Irssi::current_theme; + +    $prompt = $theme->format_expand("{uberprompt $prompt_arg}"); -    if (defined $prompt_data) { -        # replace the special marker '$p' with the original prompt. -        $p_copy =~ s/\$/\$\$/g; # escape all $ symbols -        $p_copy =~ s/\\/\\\\/g; # escape backslashes. +    if ($prompt_data_pos eq 'UP_ONLY') { +        $prompt =~ s/\$\$uber//; # no need for recursive prompting, I hope. -        $p_copy =~ s/\$\$p/$default_prompt/; +        # TODO: only compute this if necessary? +        my $prompt_nt = $prompt; +        $prompt_nt =~ s/\s+$//; + +        my $pdata_copy = $prompt_data; + +        $pdata_copy =~ s/\$prompt_nt/$prompt_nt/; +        $pdata_copy =~ s/\$prompt/$prompt/; + +        $prompt = $pdata_copy; + +    } elsif ($prompt_data_pos eq 'UP_INNER' && defined $prompt_data) { +        my $esc = _escape_prompt_special($prompt_data); +        $prompt =~ s/\$\$uber/$esc/;      } else { -        $p_copy = $default_prompt; +        # remove the $uber marker +        $prompt =~ s/\$\$uber//; + +        # and add the additional text at the appropriate position. +        if ($prompt_data_pos eq 'UP_PRE') { +            $prompt = $prompt_data . $prompt; +        } elsif ($prompt_data_pos eq 'UP_POST') { +            $prompt .= $prompt_data; +        }      } -    print "Redrawing with: $p_copy, size-only: $get_size_only" if DEBUG; +    print "Redrawing with: $prompt, size-only: $get_size_only" if DEBUG; -    my $ret = $sb_item->default_handler($get_size_only, $p_copy, '', 0); -    # TODO: do this properly, and also make sure it's only emitted once per -    # change. -    Irssi::signal_emit('prompt changed', $p_copy, $sb_item->{size}); +    if ($prompt ne $prompt_last) { + +        # print "Emitting prompt changed signal" if DEBUG; +        # my $exp = Irssi::current_theme()->format_expand($text, 0); +        my $ps = Irssi::parse_special($prompt); + +        Irssi::signal_emit('prompt changed', $ps, length($ps)); +        $prompt_last = $prompt; +    } +    my $ret = $sb_item->default_handler($get_size_only, $prompt, '', 0);      return $ret;  } @@ -281,6 +358,3 @@ sub _sbar_command {      Irssi::command($command);  } -# bit of fakery so things don't complain about the lack of prompt_info (hoepfully) - -%Irssi::Script::prompt_info:: = (); diff --git a/scrolled-reminder/scrolled_reminder.pl b/scrolled-reminder/scrolled_reminder.pl index b69e3df..b1deb9c 100644 --- a/scrolled-reminder/scrolled_reminder.pl +++ b/scrolled-reminder/scrolled_reminder.pl @@ -1,3 +1,58 @@ +# ABOUT: +# +# This script attempts to prevent you from responding accidentally to long-finished +# conversations if you have scrolled back and are not viewing the current activity +# of the channel. +# +# If you attempt to send a message when you are not at the most recent point in the +# channel buffer, it will intercept the message and offer you a menu of options +# instead. +# +# USAGE: +# +# When scrolled up and sending a message, the subsequent prompt has the following +# options: +# +# * Ctrl-C - cancel sending the message. It remains in your input line, but is not +#            sent to the channel. +# * Ctrl-K - send the message to the channel. The input line is cleared. +# * Space  - Jump to the bottom (most recent) part of the channel buffer. +#            Unlike the first two, this does not cancel the prompt, so it allows +#            you to determine if your message is still appropriate before sending. +# +# +# INSTALL: +# +# This script requires that you have first installed and loaded 'uberprompt.pl' +# Uberprompt can be downloaded from: +# +# http://github.com/shabble/irssi-scripts/raw/master/prompt_info/uberprompt.pl +# +# and follow the instructions at the top of that file for installation. +# +# LICENCE: +# +# Copyright (c) 2010 Tom Feist +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +  use strict;  use warnings; @@ -7,16 +62,8 @@ use Irssi::Irc;  use Data::Dumper; -# Everyone is permitted to copy and distribute verbatim or modified -# copies of this license document, and changing it is allowed as long -# as the name is changed. - -#             DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE -#    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -#   0. You just DO WHAT THE FUCK YOU WANT TO. - -sub DEBUG () { 1 } +my $DEBUG_ENABLED = 0; +sub DEBUG () { $DEBUG_ENABLED }  our $VERSION = '0.01';  our %IRSSI = @@ -27,8 +74,8 @@ our %IRSSI =     description => 'Requires confirmation to messages sent'                    . 'when the current window is scrolled up', -   license     => 'WTFPL; http://sam.zoy.org/wtfpl/', -   url         => 'http://github.com/shabble/shab-irssi-scripts/' +   license     => 'MIT', +   url         => 'http://github.com/shabble/irssi-scripts/'                    . 'tree/master/scrolled-reminder/',               ); @@ -44,8 +91,8 @@ sub script_is_loaded {      return $retval;  } -unless (script_is_loaded('prompt_info')) { -    die "This script requires 'prompt_info' in order to work. " +unless (script_is_loaded('uberprompt')) { +    die "This script requires the 'uberprompt.pl' script in order to work. "        . "Please load it and try again";  } else {      scroll_reminder_init(); @@ -56,11 +103,23 @@ my $pending_input = {};  my $active;  sub scroll_reminder_init { + +      $permit_pending = 0;      $active = 0; + +    Irssi::settings_add_bool('scrollminder', 'scrollminder_debug', 0); +      # we need to be first so we can intercept stuff.      Irssi::signal_add_first('send text', \&handle_send_text);      Irssi::signal_add_first('gui key pressed', \&handle_keypress); +    Irssi::signal_add('setup changed' => \&setup_changed); + +    setup_changed(); +} + +sub setup_changed { +    $DEBUG_ENABLED = Irssi::settings_get_bool('scrollminder_debug');  }  ################################################################ @@ -181,5 +240,5 @@ sub set_prompt {      my $msg = shift;      # add a leading space unless we're trying to clear it entirely.      $msg = ' ' . $msg if length $msg; -    Irssi::signal_emit('change prompt', $msg); +    Irssi::signal_emit('change prompt', $msg, 'UP_INNER');  } | 
