Re: [gtk-list] Re: New key-binding system



On Thu, Jul 09, 1998 at 06:34:37PM -0400, Owen Taylor wrote:
> > That is kind of what i was thinking except there needs to be a way to
> > handle 
> > when the user hits the <esc> key.    in this case if the user is in
> > insertmode
> > then they drop to command mode.  BUT, if they are in command mode the
> > <esc>
> > is sent to the handler.    NOTICE  this is differnt then the example
> > above, which
> > is why i think i have problems with the proposed methodology.
> 
> This is more tricky; but what does escape do in command mode
> for VI? Nothing, right? At least my approach to VI is
> compulsively hit escape to make sure I'm in the right mode,
> and it never seems to do harm...
> 
> [ This does show that it needs to be "set-command-mode" not  
>   "toggle-command-mode" ]

yup ... set-command-mode in command mode does nothing so there
should be no problem ... actually there is an action ... it's
usually a beep :)

> If you really need state-dependent processing, you can
> have action-signals that are ignored in one state, and activated
> in another, but I think trying to do that in the bindings is heading
> towards making the bindings a scripting language, which is
> not where we want to go. [ Inventing a new scripting language
> is, nowdays, _never_ the right thing to do, IMO ]

nope that would be bad ... one thing that might be ok is probably
have the binding be state specific ... which doesn't involve anything
too bad ... so you'd do bind for instert state .. and bindcommand
for command mode ...

even that is getting more complicated but probably a bit more
flexible ... I don't really see a need for it ... in vi the commands
you need are all letters (except a few which won't hurt being bound
in both anyway) ... and letters will only pass through the keypress
handler if it's in command mode ... so I guess ... it should be dead
simple to do this

> Though, one example I used when I first proposed this to
> Tim Janik was for an application with an embedded Perl
> interpreter:
> 
>  bind "<Alt>:" { 
>   "execute-script" ("$e = shift; $e->set_text (eval $e->get_text)")
>  }
> 
> [ For an Entry ]

ummmm ..... I don't think you'd want to link perl with gtk ... just for
bindings ... that would probably not be worth it 

we don't need to build complete vi editor for the entry or text widget,
if one would need that one can either create a widget for it or embed
a vi window in there (or emacs or whatnot) ... even for vi bindings ...
except for some state control (which can be VERY simple) ... nothing more
is needed

George

-- 
------------------------------------------------------------------------------
George Lebl <jirka@5z.com> http://www.5z.com/jirka/
------------------------------------------------------------------------------
  The following implements RSA in perl and is illegal to export from the US:

          #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
          $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
          lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]