Marketplace products
Multiple Undo/Redo
- Cost
- Free
- Version
- 1
Page 1 of 2
- Overview
- Screen Shots
Overview
This source code allows you to add multiple undo/redo to your text editor, while keeping full control over when to record events or not. The code also 'remembers' what type of edit occurred (i.e. delete text, paste text etc), and allows you to go back in multiple stages, like in Office 97. You can also specify the Undo limit, and clear its memory too!
This code is excellent. Most people should find it simple to understand and very easy to integrate with an application.
Found one bug. If you highlight a block of text, then press the TAB key, the text is properly replaced. However, you can't undo the action. This bug can be fixed as follows:
In rtDoc_KeyPress(KeyAscii As Integer)
Change this line:
ElseIf KeyAscii >= 32 Or KeyAscii = 13 Then
To this:
ElseIf KeyAscii >= 32 Or KeyAscii = 13 Or KeyAscii = vbKeyTab Then
This is very useful code. Thanks. I fixed what seem to me to be a couple of bugs.
Bug 1
If the Delete key is used to delete the next character, status will not get updated.
Fix For Bug 1
In
AddToUndoStack cUndo
I added
This is necessary because, if you just delete the next character, you have not changed the selection start point or the selection length (0), so
Bug 2
After a redo followed by an undo, the redo could not be done again.
Maybe this is supposed to be a feature rather than a bug, but I think it is a bug: that is not how Microsoft Word or the VB6 editor behave, and I do not want it to happen in my program.
Fix For Bug 2
Delete the following code.
If bRedoing Then
bRedoing = False
ClearStack RedoStack
End If
End Sub
This thread is for discussions of Multiple Undo/Redo.