From d73663a24778c4b88197aea00626fb72b3eef8b3 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 7 Jul 2014 15:59:07 +0400 Subject: [PATCH] diff: fix LineStatusTracker highlighter ranges fix issue with insertion of empty string (in the middle of file, issue with the end of file still present) bug caused by 7be7a24449d9a6ebd65e93f5f28e7c9069517947 --- .../com/intellij/openapi/vcs/ex/LineStatusTracker.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java index 8b9884502755..ac0bc8608368 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java @@ -174,11 +174,15 @@ public class LineStatusTracker { private RangeHighlighter createHighlighter(final Range range) { LOG.assertTrue(!myReleased, "Already released"); - TextRange textRange = getCurrentTextRange(range); + int first = + range.getOffset1() >= myDocument.getLineCount() ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getOffset1()); + + int second = + range.getOffset2() >= myDocument.getLineCount() ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getOffset2()); final RangeHighlighter highlighter = DocumentMarkupModel.forDocument(myDocument, myProject, true) - .addRangeHighlighter(textRange.getStartOffset(), textRange.getEndOffset(), HighlighterLayer.FIRST - 1, null, - HighlighterTargetArea.LINES_IN_RANGE); + .addRangeHighlighter(first, second, HighlighterLayer.FIRST - 1, null, HighlighterTargetArea.LINES_IN_RANGE); + final TextAttributes attr = LineStatusTrackerDrawing.getAttributesFor(range); highlighter.setErrorStripeMarkColor(attr.getErrorStripeColor()); highlighter.setThinErrorStripeMark(true);