#!/usr/bin/perl

# hs: show a help section, but don't scroll more that one page;
#     also, move to the status window,
#           where the help section will be displayed.

use strict;
use warnings;
use Irssi;

sub cmd_help_scroll {
    my $server = Irssi::active_server();
    $server->command("window goto (status)");
    my $win = Irssi::active_win();
    $server->command("scrollback end");
    $win->command('^window scroll off');
    $server->command("help $_[0]");
    $win->command('^window scroll on');
    $server->command("scrollback goto +$win->{height}");
}

Irssi::command_bind('hs', 'cmd_help_scroll');
