Changeset 6700c605


Ignore:
Timestamp:
Dec 24, 2009, 6:18:51 PM (10 years ago)
Author:
Alex Dehnert <adehnert@mit.edu>
Branches:
master, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
980fa31
Parents:
c471e85
git-author:
Alex Dehnert <adehnert@mit.edu> (12/20/09 01:50:12)
git-committer:
Alex Dehnert <adehnert@mit.edu> (12/24/09 18:18:51)
Message:
Allow left/right scrolling by arbitrary amount

Move recv:{left,right}shift to Perl and make
them optionally accept a number of columns to
scroll by (default: 10).
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r8c97fa1 r6700c605  
    320320  OWLCMD_INT("recv:setshift", owl_command_set_shift, OWL_CTX_INTERACTIVE,
    321321              "scrolls receive window to specified position", "", ""),
    322 
    323   OWLCMD_VOID("recv:shiftleft", owl_command_shift_left, OWL_CTX_INTERACTIVE,
    324               "scrolls receive window to the left", "", ""),
    325 
    326   OWLCMD_VOID("recv:shiftright", owl_command_shift_right, OWL_CTX_INTERACTIVE,
    327               "scrolls receive window to the left", "", ""),
    328322
    329323  OWLCMD_VOID("recv:pagedown", owl_function_mainwin_pagedown,
     
    13611355  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    13621356  owl_global_set_needrefresh(&g);
    1363 }
    1364 
    1365 void owl_command_shift_left(void)
    1366 {
    1367   owl_function_shift_left();
    1368 }
    1369 
    1370 void owl_command_shift_right(void)
    1371 {
    1372   owl_function_shift_right();
    13731357}
    13741358
  • perl/lib/BarnOwl.pm

    r1b9a163 r6700c605  
    3838use BarnOwl::Completion;
    3939
     40use List::Util qw(max);
     41
    4042=head1 NAME
    4143
     
    421423                       });
    422424
     425    # Receive window scrolling
     426    BarnOwl::new_command("recv:shiftleft",
     427                        \&BarnOwl::recv_shift_left,
     428                        {
     429                            summary => "scrolls receive window to the left",
     430                            usage => "recv:shiftleft [<amount>]",
     431                            description => <<END_DESCR
     432By default, scroll left by 10 columns. Passing no arguments or 0 activates this default behavior.
     433Otherwise, scroll by the number of columns specified as the argument.
     434END_DESCR
     435                        });
     436
     437    BarnOwl::new_command("recv:shiftright",
     438                        \&BarnOwl::recv_shift_right,
     439                        {
     440                            summary => "scrolls receive window to the right",
     441                            usage => "recv:shiftright [<amount>]",
     442                            description => <<END_DESCR
     443By default, scroll right by 10 columns. Passing no arguments or 0 activates this default behavior.
     444Otherwise, scroll by the number of columns specified as the argument.
     445END_DESCR
     446                        });
     447
    423448}
    424449
     
    485510}
    486511
     512=head3 Receive window scrolling
     513
     514Permit scrolling the receive window left or right by arbitrary
     515amounts (with a default of 10 characters).
     516
     517=cut
     518
     519sub recv_shift_left
     520{
     521    my $func = shift;
     522    my $delta = shift;
     523    $delta = 10 unless int($delta) > 0;
     524    my $shift = BarnOwl::recv_getshift();
     525    if($shift > 0) {
     526        BarnOwl::recv_setshift(max(0, $shift-$delta));
     527    } else {
     528        return "Already full left";
     529    }
     530}
     531
     532sub recv_shift_right
     533{
     534    my $func = shift;
     535    my $delta = shift;
     536    $delta = 10 unless int($delta) > 0;
     537    my $shift = BarnOwl::recv_getshift();
     538    BarnOwl::recv_setshift($shift+$delta);
     539}
     540
    487541=head3 default_zephyr_signature
    488542
Note: See TracChangeset for help on using the changeset viewer.