From 484fc1803d685f662a7c592964d6a562ed5f303d Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Mon, 17 Oct 2011 15:14:50 +0400 Subject: [PATCH] EA-29837 - IAE: DocumentImpl.replaceString --- .../com/intellij/openapi/editor/impl/TextChangeImpl.java | 6 ++---- .../codeInsight/editorActions/AutoHardWrapHandler.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java index a7a4bebab18a..5514c62b2db2 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/TextChangeImpl.java @@ -36,7 +36,7 @@ public class TextChangeImpl implements TextChange { private int myEnd; /** - * Shorthand for creating {@link TextChangeImpl} with the given arguments where 'end index' has the same value as + * Shorthand for creating change object with the given arguments where 'end index' has the same value as * 'start index'. * * @param text text affected by the current change @@ -137,9 +137,7 @@ public class TextChangeImpl implements TextChange { /** * Applies given offset applied to the {@link #getStart() start} and {@link #getEnd() end} properties of current text change object. * - * @param offset offset to apply to the current change object - * @return text change that is built on the basis of the current object that with {@link #getStart() start} - * and {@link #getEnd() end} positions shifted to the given offset + * @param offset offset to apply to the current change object * @throws IllegalArgumentException if start index becomes zero after given offset appliance (it is not applied then) */ public void advance(int offset) throws IllegalArgumentException { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.java index 89bdba70f2d2..37e5b881a871 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/AutoHardWrapHandler.java @@ -175,7 +175,7 @@ public class AutoHardWrapHandler { caretOffsetDiff[0] += event.getNewLength() - event.getOldLength(); } - if (event.getNewLength() <= 0) { + if (event.getNewLength() <= event.getOldLength()) { // There is a possible case that document fragment is removed because of auto-formatting. We don't want to process such events. return; }