Undo for "vi"
Mike Dean
mdean at emacinc.com
Tue Mar 18 16:51:43 UTC 2014
I haven't worked with the code, but to me, it looks like:
1. it's stuffing a pointer to the first index into the passed in array into
q
2. it's replacing any newlines in the string with nulls
3. it's calling a colon() function to execute the command mode command
associated with the string that was passed in.
How about adding the feature of interpreting an interrupt (Control-C) as
the Esc key, just like vim does? That's the feature I miss most, and one
of the reasons I switched our embedded Linux distro to using the full vim
instead of the Busybox one.
Mike Dean
mdean at emacinc.com
http://www.emacinc.com/
Engineer
EMAC, Inc.
618-529-4525 Ext. 330
618-457-0110 Fax
2390 EMAC Way
Carbondale, Il 62901
On Tue, Mar 18, 2014 at 9:51 AM, Jody Bruchon <jody at jodybruchon.com> wrote:
> On 3/18/2014 9:24 AM, Laszlo Papp wrote:
>
>> Hi,
>>
>> do you plan to implement this feature any soon? It would be really
>> useful. Currently, it is a bit difficult to do undo in certain
>> scenarios when editing files on the embedded board.
>>
>
> Out of an interest in seeing this feature, I'm looking at vi.c and find
> that the code is not terribly well commented. For example, variables 'p'
> and 'q' are used throughout the code but no explanation of what they are
> supposed to be for or what is happening with them exists.
>
> Could someone who has worked on this code give me an idea of what this
> block of code really does?
>
> -snip-
>
> #if ENABLE_FEATURE_VI_COLON
> {
> char *p, *q;
> int n = 0;
>
> while ((p = initial_cmds[n]) != NULL) {
> do {
> q = p;
> p = strchr(q, '\n');
> if (p)
> while (*p == '\n')
> *p++ = '\0';
> if (*q)
> colon(q);
> } while (p);
> free(initial_cmds[n]);
> initial_cmds[n] = NULL;
> n++;
> }
> }
> #endif
>
> -snip-
>
>
> Thanks in advance!
> -Jody Bruchon
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140318/a0d3712c/attachment.html>
More information about the busybox
mailing list