diff options
author | Dani Megert | 2006-04-27 10:14:51 +0000 |
---|---|---|
committer | Dani Megert | 2006-04-27 10:14:51 +0000 |
commit | 4e7d35013d1a83ae020aac503b9c50a93315028b (patch) | |
tree | aabe5a34b98cb980cadfeae5f821000d2dcbc149 /org.eclipse.text | |
parent | d24b1ef0cdca61ac8f5b1cb6e862a66c285da794 (diff) | |
download | eclipse.platform.text-4e7d35013d1a83ae020aac503b9c50a93315028b.tar.gz eclipse.platform.text-4e7d35013d1a83ae020aac503b9c50a93315028b.tar.xz eclipse.platform.text-4e7d35013d1a83ae020aac503b9c50a93315028b.zip |
Fixed bug 123473: [typing] Deletion not added to undo stack unless selection changes firstv20060427-0800
Diffstat (limited to 'org.eclipse.text')
-rw-r--r-- | org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java index 0871ef5ca6c..69aeb3ccd37 100644 --- a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java +++ b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java @@ -260,6 +260,7 @@ public class DocumentUndoManager implements IDocumentUndoManager { if (isValid()) { fDocumentUndoManager.fireDocumentUndo(fStart, fPreservedText, fText, uiInfo, DocumentUndoEvent.ABOUT_TO_UNDO, false); undoTextChange(); + fDocumentUndoManager.resetProcessChangeState(); fDocumentUndoManager.fireDocumentUndo(fStart, fPreservedText, fText, uiInfo, DocumentUndoEvent.UNDONE, false); return Status.OK_STATUS; } @@ -289,8 +290,8 @@ public class DocumentUndoManager implements IDocumentUndoManager { */ public IStatus redo(IProgressMonitor monitor, IAdaptable uiInfo) { if (isValid()) { - fDocumentUndoManager.fireDocumentUndo(fStart, fText, fPreservedText, uiInfo, DocumentUndoEvent.ABOUT_TO_REDO, false); redoTextChange(); + fDocumentUndoManager.resetProcessChangeState(); fDocumentUndoManager.fireDocumentUndo(fStart, fText, fPreservedText, uiInfo, DocumentUndoEvent.REDONE, false); return Status.OK_STATUS; } @@ -334,6 +335,7 @@ public class DocumentUndoManager implements IDocumentUndoManager { updateTextChange(); fDocumentUndoManager.fCurrent= createCurrent(); } + fDocumentUndoManager.resetProcessChangeState(); } /** @@ -464,6 +466,7 @@ public class DocumentUndoManager implements IDocumentUndoManager { c= (UndoableTextChange) fChanges.get(i); c.undoTextChange(); } + fDocumentUndoManager.resetProcessChangeState(); fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fPreservedText, c.fText, uiInfo, DocumentUndoEvent.UNDONE, true); } @@ -486,6 +489,7 @@ public class DocumentUndoManager implements IDocumentUndoManager { c= (UndoableTextChange) fChanges.get(i); c.redoTextChange(); } + fDocumentUndoManager.resetProcessChangeState(); fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fText, c.fPreservedText, uiInfo, DocumentUndoEvent.REDONE, true); } @@ -534,8 +538,9 @@ public class DocumentUndoManager implements IDocumentUndoManager { if (fStart > -1) updateTextChange(); fDocumentUndoManager.fCurrent= createCurrent(); + fDocumentUndoManager.resetProcessChangeState(); } - + /* * @see org.eclipse.text.undo.UndoableTextChange#isValid() */ @@ -803,11 +808,6 @@ public class DocumentUndoManager implements IDocumentUndoManager { * @see org.eclipse.jface.text.IDocumentUndoManager#commit() */ public void commit() { - - fInserting= false; - fOverwriting= false; - fPreviousDelete.reinitialize(); - // if fCurrent has never been placed on the history, do so now. // this can happen when there are multiple programmatically commits in a // single document change. @@ -1199,6 +1199,17 @@ public class DocumentUndoManager implements IDocumentUndoManager { addListeners(); } + + /** + * Reset processChange state. + * + * @since 3.2 + */ + private void resetProcessChangeState() { + fInserting= false; + fOverwriting= false; + fPreviousDelete.reinitialize(); + } /** * Shutdown the receiver. |