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



On Wed, Jul 15, 1998 at 12:39:01AM -0600, Tom Tromey wrote:
> Owen> I suppose it would help with pseudo-vi bindings as well as
> Owen> pseudo-emacs bindings, though. You could get things like 'dd' to
> Owen> work, though not 'y4w'.
> 
> Yeah, vi requires more state than just a keymap.  So does Emacs if you
> want to handle prefix arguments.

well it wouldn't be that hard to implement basic state control for vi
and then one could have almost full blown vi bindings ...

one would be a small integer (few bits are enough) .. another one would be
an enum with several kinds of "edits" types ... (DELETE, CHANGE, YANK)

then have bindigs set these (a numeral would set the integer, an edit
command would set the enum) ... then a move command would follow ...
the move command would look and if the above two are at defaults (NO edit
and 1 ...) it would just do the move as normal (so those moves could
be used for any bindings) .. if there were an edit, it does a simple
thing, set mark (select, whatever) ... does the move as usual .... then does
end mark .... then it executes the right edit binding

probably a few lines of code and you have major part of vi supported quite
well 

one way to make it simpler would be this ....

implement more state control ... basically add an entire integer for state
(this wouldn't solve the numbers in vi commands, a way to read integers was
integrated in there, which would be trivial if only 1-9 were supported)

anyway ... say a c (change) command would put the state into state say 3
... and only bindings for state 3 would apply ...

hmmm .. is this all worth it? ... dunno .... however it would be very nice
to add statefull bindings, as I'm sure they will be usefull for other things

should I shut up? ... yes :)

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]