[PATCH v3] Complete Undo command support for vi

jody at jodybruchon.com jody at jodybruchon.com
Wed Mar 19 05:23:29 UTC 2014


This is my latest patch to add 'u' (Undo) command support to BusyBox vi and it
is a major improvement over the previous two.

Improvements over v2:
* Seems to work with all editing functions I could test
* Find-and-replace undo now works; can reverse e.g. :1,3 s/foo/bar/
* Friendly constants for undo flags (UNDO_INS, ALLOW_UNDO, etc.)
* Removed dot_delete() (was only calling another function and only used once)
* Proper #if/#else/#endif (builds without undo don't waste a parameter now)
* Patch also uses file_modified in a MUCH more logical/sane manner

Tested on x86_64, probably works everywhere though. On x86_64, it only weighs in
at +1266 bytes of text with no change in data/bss. I feel that this patch is
largely complete; however, I would like to eventually implement some form of
input grouping so that it doesn't malloc() twice for every single action taken
including a single character being typed within insert mode (and it doubles for
replace mode), which is the biggest problem I can see. Fortunately, it is
unlikely that this will exhaust memory on systems with even a modest amount of
RAM.

I am very happy to be able to contribute something of value to BusyBox! :-)

Signed-off-by: Jody Bruchon <jody at jodybruchon.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox_vi_undo_v3.patch
Type: application/octet-stream
Size: 24702 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140319/76be95ea/attachment-0001.obj>


More information about the busybox mailing list