Tk-TextVi

 view release on metacpan or  search on metacpan

lib/Tk/TextVi.pm  view on Meta::CPAN

    if( defined $mode ) {
        croak "Tk::TextVi received invalid mode '$mode'"
            if $mode !~ m[ ^ [nicvVR/] $ ]x;
        $w->{VI_MODE} = $mode;
        $w->{VI_SUBMODE} = '';
        $w->{VI_PENDING} = '';
        $w->{VI_REPLACE_CHARS} = '';
        $w->tagRemove( 'sel', '1.0', 'end' );

        # XXX: Hack
        if( (caller)[0] eq 'Tk::TextVi' ) {
            $w->{VI_FLAGS} |= F_STAT;
        }
        else {
            # TODO: this is broken
            $w->Callback( '-statuscommand', $w->{VI_MODE}, $w->{VI_PENDING} );
        }
    }

    return $rv;
}

lib/Tk/TextVi.pm  view on Meta::CPAN

            $w->{VI_REPLACE_CHARS} .= "\0";
            $w->insert( 'insert', $key );
        }
    }
    else {
        die "Tk::TextVi internal state corrupted";
    }

    # Does the UI need to update?
    # XXX: HACK
    if( (caller)[0] ne 'Tk::TextVi' ) {
        $w->Callback( '-statuscommand',
            $w->viMode,
            $w->{VI_PENDING} ) if( $w->{VI_FLAGS} & F_STAT );
        $w->Callback( '-messagecommand' ) if $w->{VI_FLAGS} & F_MSG ;
        $w->Callback( '-errorcommand' ) if $w->{VI_FLAGS} & F_ERR ;

        $w->{VI_FLAGS} = 0;
    }

    # Command may have moved insert cursor out of window



( run in 0.606 second using v1.01-cache-2.11-cpan-1e74a51a04c )