diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentLineMarker.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentLineMarker.java index 380f8fc7d408..20d70c47167d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentLineMarker.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/PersistentLineMarker.java @@ -32,16 +32,18 @@ public class PersistentLineMarker extends RangeMarkerImpl { public void documentChanged(DocumentEvent e) { if (!isValid()) return; - DocumentEventImpl event = (DocumentEventImpl) e; + DocumentEventImpl event = (DocumentEventImpl)e; if (event.isWholeTextReplaced()) { myLine = event.translateLineViaDiff(myLine); if (myLine < 0 || myLine >= getDocument().getLineCount()) { invalidate(); - } else { + } + else { myStart = MarkupModelImpl.getFirstNonspaceCharOffset(getDocument(), myLine); myEnd = myStart; } - } else { + } + else { super.documentChanged(e); if (isValid()) { myLine = getDocument().getLineNumber(myStart); 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 2235bd6cb444..8181852571f9 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 @@ -65,6 +65,9 @@ public class PersistentRangeMarker extends RangeMarkerImpl { else{ myEnd = getDocument().getLineStartOffset(myEndLine) + myEndColumn; } + if (myEnd < myStart) { + invalidate(); + } } else{ super.documentChanged(e);