From b2dd678520fd99ab28b148aedf7461d560ed2915 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 12 Feb 2010 19:10:04 +0300 Subject: [PATCH] changedUpdate exception --- .../openapi/editor/impl/PersistentRangeMarker.java | 14 ++++++++++---- .../openapi/editor/impl/event/DocumentEventImpl.java | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarker.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarker.java index deda8e1479..4ced1bef5d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarker.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentRangeMarker.java @@ -38,10 +38,16 @@ public class PersistentRangeMarker extends RangeMarkerImpl { if (getStartOffset() < myDocument.getTextLength()) { myStartLine = myDocument.getLineNumber(getStartOffset()); myStartColumn = getStartOffset() - myDocument.getLineStartOffset(myStartLine); + if (myStartColumn < 0) { + invalidate(); + } } if (getEndOffset() < myDocument.getTextLength()) { myEndLine = myDocument.getLineNumber(getEndOffset()); myEndColumn = getEndOffset() - myDocument.getLineStartOffset(myEndLine); + if (myEndColumn < 0) { + invalidate(); + } } } @@ -64,15 +70,15 @@ public class PersistentRangeMarker extends RangeMarkerImpl { else{ myEnd = getDocument().getLineStartOffset(myEndLine) + myEndColumn; } - if (myEnd < myStart) { - invalidate(); - } } - else{ + else { super.changedUpdateImpl(e); if (isValid()){ storeLinesAndCols(); } } + if (myEnd < myStart || myEnd > getDocument().getTextLength()) { + invalidate(); + } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/event/DocumentEventImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/event/DocumentEventImpl.java index a6b9cc701a..d73844a047 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/event/DocumentEventImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/event/DocumentEventImpl.java @@ -132,7 +132,7 @@ public class DocumentEventImpl extends DocumentEvent { @SuppressWarnings({"HardCodedStringLiteral"}) public String toString() { return "DocumentEventImpl[myOffset=" + myOffset + ", myOldLength=" + myOldLength + ", myNewLength=" + myNewLength + - ", myOldString='" + myOldString + "', myNewString='" + myNewString + "']"; + ", myOldString='" + myOldString + "', myNewString='" + myNewString + "']" + (isWholeTextReplaced() ? " Whole." : "."); } public boolean isWholeTextReplaced() { -- 2.11.4.GIT