[PATCH] Complete undo support for vi with intermediate queuing
Denys Vlasenko
vda.linux at googlemail.com
Wed Apr 2 11:49:02 UTC 2014
On Sun, Mar 23, 2014 at 9:30 PM, jody at jodybruchon.com
<jody at jodybruchon.com> wrote:
> I have spent a lot of time working on it, and I finally have this patch for
> complete undo support for BusyBox 'vi' with intermediate queuing capability.
> This patch INCLUDES my previous "undo patch v3" and also fixes the following
> issues with that patch:
>
> * Cursor placement when undoing is now correct
> * Undoing a 'dd' of the only line in the file no longer inserts a stray newline
> * Undoing 'J' no longer randomly destroys the first char of the line
>
> The biggest change is the "undo queuing" feature. When the undo queue feature is
> compiled in, single-character operations such as typing and backspacing will be
> grouped together. This greatly reduces malloc() calls while typing and makes
> undo much more useful; instead of each 'u' keypress undoing one typed character,
> all of the characters typed up to the queue size limit will be undone in one
> shot.
>
> The function undo_queue_commit() is called on certain keypresses to further
> increase the usefulness of queuing. Changing between typing and backspacing or
> moving the cursor during typing will "commit" the queue to an undo object,
> thereby splitting them into logical groupings.
>
> The queue size is configurable, the queue can be disabled, and undo support can
> be disabled completely, which will compile BusyBox vi identically to how it is
> built now. I have tested compilation AND as many of the possible text
> manipulation functions as I could with all possible combinations of undo support
> compiled in. I've tried to find bugs in the code in as many ways as possible,
> and it seems to work correctly under everything I have thrown at it. I doubt
> that this work on the undo feature can be improved any further.
>
> Denys, would you mind trying this final patch out and applying it?
It looks good. I did some changes, please review attached patch.
I noticed one bug so far: when I "busybox vi new_file", press i, and
start typing,
the status line isn't switching to "[Modified]". It used to.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9.patch
Type: text/x-patch
Size: 31826 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20140402/01f2bb1c/attachment-0001.bin>
More information about the busybox
mailing list