From b22280a2a7444a89899c3a8ff234eee6c4026f25 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Thu, 2 Dec 2010 01:36:00 +0000 Subject: sb_position: moved register and sig code into init(), weird hacky bugfix for FS#242 --- sb-position/sb_position.pl | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'sb-position') diff --git a/sb-position/sb_position.pl b/sb-position/sb_position.pl index 813ee31..61e5978 100644 --- a/sb-position/sb_position.pl +++ b/sb-position/sb_position.pl @@ -20,9 +20,11 @@ use strict; use warnings; -use Irssi (); +use Irssi; use POSIX qw(ceil); +{ package Irssi::Nick } + our $VERSION = '0.1'; our %IRSSI = ( authors => 'Simon Ruderich, Tom Feist', @@ -36,20 +38,22 @@ our %IRSSI = ( my ($buf, $size, $pos, $height); my ($pages, $cur_page, $buf_percent); -# (re-)register it so we can access the WIN_REC object directly. -Irssi::signal_register({'gui page scrolled' => [qw/Irssi::UI::Window/]}); -# primary update signal. -Irssi::signal_add('gui page scrolled', \&update_position); -Irssi::statusbar_item_register('position', 0, 'position_statusbar'); - -Irssi::signal_add("window changed", \&update_position); -Irssi::signal_add_last("command clear", \&update_position); -Irssi::signal_add_last("command scrollback", \&update_position); -# Irssi::signal_add_last("gui print text finished", sig_statusbar_more_updated); init(); sub init { + + # (re-)register it so we can access the WIN_REC object directly. + Irssi::signal_register({'gui page scrolled' => [qw/Irssi::UI::Window/]}); + # primary update signal. + Irssi::signal_add('gui page scrolled', \&update_position); + Irssi::statusbar_item_register('position', 0, 'position_statusbar'); + + Irssi::signal_add("window changed", \&update_position); + Irssi::signal_add_last("command clear", \&update_position); + Irssi::signal_add_last("command scrollback", \&update_position); + # Irssi::signal_add_last("gui print text finished", sig_statusbar_more_updated); + update_position(Irssi::active_win()); } -- cgit v1.2.3