Changeset 68 for trunk

Show
Ignore:
Timestamp:
05/06/08 15:49:23 (8 months ago)
Author:
scott
Message:

Various bug fixes for CuIRC…

Client is almost usable now. Fixes include:

  • TextEditor? input widget stays in focus at all times
  • Page up and page down actually scroll the main screen (although the scroll gets reset on incoming message).
  • /msg no longer crashes client (same with /kick).
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Curses-UI-POE/examples/irc_client

    r67 r68  
    135135use Curses; 
    136136use Carp qw( carp ); 
     137use constant KEY_TAB => "\t"; 
    137138 
    138139my @nicks; 
     
    283284        ); 
    284285 
     286    my $set_editor_focus = sub { 
     287        $editor->focus; 
     288        $editor->draw; 
     289    }; 
     290 
     291    $nicks->onFocus($set_editor_focus); 
     292    $viewer->onFocus($set_editor_focus); 
     293    $menu->onFocus($set_editor_focus); 
    285294 
    286295    my (%Channel, $Current, @History); 
     
    321330 
    322331        nick => sub { $poe_kernel->post( IRC => nick => $_[1] ) }, 
    323         kick => sub { $poe_kernel->post( IRC => kick => $_[1..$#_] ) }, 
    324         msg  => sub { $poe_kernel->post( IRC => privmsg => $_[1..$#_] ) }, 
     332        kick => sub { $poe_kernel->post( IRC => kick => @_[1..$#_] ) }, 
     333        msg  => sub { $poe_kernel->post( IRC => privmsg => @_[1..$#_] ) }, 
    325334         
    326335        quote => sub { 
     
    364373        } 
    365374    }, KEY_ENTER; 
     375 
     376    set_binding $editor sub { 
     377        # Do nothing...overload the lose-focus event. 
     378    }, KEY_TAB, KEY_BTAB; 
     379 
     380    # Why doesn't this work? 
     381    set_binding $editor sub { 
     382        warn "Calling \$viewer->cursor_pageup"; 
     383        $viewer->cursor_pageup; 
     384        $viewer->draw; 
     385    }, KEY_PPAGE; 
     386 
     387    set_binding $editor sub { 
     388        warn "Calling \$viewer->cursor_pagedown"; 
     389        $viewer->cursor_pagedown; 
     390        $viewer->draw; 
     391    }, KEY_NPAGE; 
    366392 
    367393    set_binding $editor sub { shift->text($History[--$Current]) }, KEY_UP; 
     
    371397        else                        { shift->text( $History[$Current] ) } 
    372398    }, KEY_DOWN; 
     399 
     400    # Focus on the editor. 
     401    $editor->focus; 
     402    $editor->draw; 
    373403 
    374404    $_[-1] = bless {