On Saturday, November 9, 2013 8:27:18 AM UTC-6, Edward K. Ream wrote:
Here is a more complex example,
>
> ('z',(
> # z- or zb redraw, current line at bottom of window
> # z. or zz redraw, current line at center of window
> # z<CR> or zt redraw, current line at top of window
> # N zh scroll screen N characters to the right
> # N zl scroll screen N characters to the left
> ('\\n',vim_zt),
> ('.',vim_zz),
> ('-',vim_zb),
> ('b',vim_zb),
> ('h',vim_zh),
> ('l',vim_zl),
> ('t',vim_zt),
> ('z',vim_zz),
> ))
>
A couple of notes about this. First, if there was any concern about
searching a list of tuples, changing '(' to '{' would create an inner dict.
I love Python :-)
More importantly, my present opinion is that we can (mostly) ignore the
distinction between commands that can be preceded by a repeat count, and
those that can't. In vim there is one command, %, which actually is two
commands, one that takes a count, and one that doesn't. But we can ignore
that for now.
For all other commands, the distinction doesn't matter. This eliminates
the cumbersome need to specify whether a repeat count is valid. Indeed,
giving a repeat count when not called for is harmless. 25^ moves the
cursor to the start of the line 25 times. A waste of time and typing, but
so what...
I don't think we want to give the user the option to distinguish commands
based on whether they are preceded by a repeat count! But if that should
be useful later, some separate hack (say another kind of @data node) would
suffice.
I am writing this note because the distinction between commands with and
without repeat count seemed important at first, but now doesn't.
Practically, it makes a big difference. It means the state machine can
always accept a leading repeat count without fuss.
The situation is different for the *second* repeat count, typically in
motion suffices. Like 25d6j. Here the motion suffix is 6j. The state
machine must be told that something after 25d is expected, and that 6 is
valid there. Some new convention (both in @data nodes and in the
corresponding tables) will be required to indicate that motion is expected
after the d command. Not sure what this will be. That's what prototypes
are for. But is will likely be a special string as the key to the
dictionary, say '-motion-', and a corresponding hack for the @data node.
Edward
P.S. I am going into detail here because writing clarifies my thinking.
And also for the record. Several people have said they enjoy watching me
think out loud :-)
The thing to notice is that there is no need to wait until everything is
clear. I would wait a long time! As the late, great Earl Nightingale
said, a train doesn't have to have *all* the lights ahead of it to be green
before starting on a journey. Just the first one ;-)
EKR
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.