From 388fea264af5b458c5252b3548702b047731ecbb Mon Sep 17 00:00:00 2001 From: Denis Zhdanov Date: Thu, 31 Mar 2011 17:12:13 +0400 Subject: [PATCH] IDEA-67327 Undo: Correct bulk undo processing at document end Corrected deferred changes processing during end -> start direction. --- .../intellij/openapi/editor/impl/TextChangesStorage.java | 2 +- .../openapi/editor/impl/TextChangesStorageTest.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/TextChangesStorage.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/TextChangesStorage.java index d2dd97bbdecd..88187b9632d1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/TextChangesStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/TextChangesStorage.java @@ -243,7 +243,7 @@ public class TextChangesStorage { if (newChangeStart <= storedClientStart && newChangeEnd >= storedClientEnd) { myChanges.remove(i); insertionIndex = i; - newChangeEnd -= changeEntry.change.getText().length(); + newChangeEnd -= changeEntry.change.getDiff(); i--; continue; } diff --git a/platform/platform-impl/testSrc/com/intellij/openapi/editor/impl/TextChangesStorageTest.java b/platform/platform-impl/testSrc/com/intellij/openapi/editor/impl/TextChangesStorageTest.java index fb4b164b0e4f..9829c64eff11 100644 --- a/platform/platform-impl/testSrc/com/intellij/openapi/editor/impl/TextChangesStorageTest.java +++ b/platform/platform-impl/testSrc/com/intellij/openapi/editor/impl/TextChangesStorageTest.java @@ -109,6 +109,13 @@ public class TextChangesStorageTest { checkChanges(c("", 2, 5)); } + @Test + public void adjacentDeletesFromEndToStart() { + delete(5, 6); + delete(4, 5); + checkChanges(c("", 4, 6)); + } + @Test public void singleReplace() { replace("abc", 3, 4);