IDEA-61798 After using RM for a while, I sometimes lose part of the chrome

Added check for the logical line number correctness
This commit is contained in:
Denis Zhdanov
2010-11-25 14:38:14 +03:00
parent 753e5ec1cb
commit c860105b14
2 changed files with 5 additions and 2 deletions
@@ -238,14 +238,14 @@ public class SegmentArray {
public int getSegmentStart(int index) {
if (index < 0 || index >= mySegmentCount) {
throw new IndexOutOfBoundsException("Wrong line: " + index);
throw new IndexOutOfBoundsException("Wrong line: " + index + ". Available lines count: " + mySegmentCount);
}
return myStarts[index];
}
public int getSegmentEnd(int index) {
if (index < 0 || index >= mySegmentCount) {
throw new IndexOutOfBoundsException("Wrong line: " + index);
throw new IndexOutOfBoundsException("Wrong line: " + index + ". Available lines count: " + mySegmentCount);
}
return myEnds[index];
}
@@ -1603,6 +1603,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
if (!getFoldingModel().isOffsetCollapsed(startOffset)) {
if (visibleStartLine >= startLineNumber && visibleStartLine <= endLineNumber) {
int logStartLine = offsetToLogicalPosition(startOffset).line;
if (logStartLine >= myDocument.getLineCount()) {
return;
}
LogicalPosition logPosition = offsetToLogicalPosition(myDocument.getLineEndOffset(logStartLine));
Point end = logicalPositionToXY(logPosition);
int charWidth = EditorUtil.getSpaceWidth(Font.PLAIN, this);