Re: Mapping some keys, like ctrl-[ and ctrl-]

From: Lee Page <lrpage_mindspring.com>
Date: Fri, 07 Sep 2007 11:38:13 -0400
Hi Jeremy,

I didn't have much luck with remapping anything but alpha-num 
characters.  In fact, it looks like alt and ctrl keys are synonomous.  
Anyway, I resorted to doing an Emacs approach, and wrote a short 
key-multiplexer.  This allows you to do C-x C-s to save, and the like.

Here is the code:

    sub lp.keyMultiplexer( doc, firstKey )
    {
        local   key   = mp.tui.getkey();
        local   function    = lp.multiplexed[ firstKey ][ key ];
       
        if( function == NULL )
        {
            mp.tui.prompt( "Oops!  key:  ctrl-" ~ firstKey ~ " " ~ key ~
    " not set up in keyMultiplexer" );
        }
        else
        {
            function( doc );
        }
    }

    lp.multiplexed      = {};
    lp.multiplexed.x    = {};

    lp.multiplexed.x.o              = mp.next;
    lp.multiplexed.x.f              = mp.actions['open'];
    lp.multiplexed.x.x              = mp.actions['cut_mark'];
    lp.multiplexed.x.u              = sub ( doc ) { mp.undo( doc ); };
    lp.multiplexed.x[ "ctrl-s" ]    = mp.actions['save'];

Let me know if you figure out the mapping of other keys.

Lee

Jeremy Cowgar wrote:
> Is it possible? Id like to:
>
>  mpkeycodes['ctrl-]'] = "next";
>  mpkeycodes['ctrl-['] = "prev";
>
> Jeremy
>
>
>



-- 
To unsubscribe, send mail to mp-unsubscribe_lists.triptico.com.
Received on Fri Sep 07 2007 - 18:03:50 CEST

This archive was generated by hypermail 2.2.0 : Thu Apr 10 2008 - 08:59:26 CEST