diff options
-rw-r--r-- | org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java index 8c53b21c5df..f1db464af23 100644 --- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java +++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java @@ -159,25 +159,27 @@ class ProjectionRulerColumn extends AnnotationRulerColumn { if (position.getOffset() > -1 && position.getLength() > -1) { try { int startLine= document.getLineOfOffset(position.getOffset()); - int end= position.getOffset() + position.getLength(); - // Bug 347628: this method expects that the offset after the position range is the - // offset of the first line after this projected line range. In other words position - // comprise the whole projected range including the last lines delimiter. If position - // ends at document end the next offset is not the next line because there is no more content. - int endLine= end != document.getLength() ? document.getLineOfOffset(end) : document.getNumberOfLines(); - if (startLine <= line && line < endLine) { - if (annotation.isCollapsed()) { - int captionOffset; - if (position instanceof IProjectionPosition) - captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document); - else - captionOffset= 0; + if (startLine <= line) { + int end= position.getOffset() + position.getLength(); + // Bug 347628: this method expects that the offset after the position range is the + // offset of the first line after this projected line range. In other words position + // comprise the whole projected range including the last lines delimiter. If position + // ends at document end the next offset is not the next line because there is no more content. + int endLine= end != document.getLength() ? document.getLineOfOffset(end) : document.getNumberOfLines(); + if (line < endLine) { + if (annotation.isCollapsed()) { + int captionOffset; + if (position instanceof IProjectionPosition) + captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document); + else + captionOffset= 0; - int captionLine= document.getLineOfOffset(position.getOffset() + captionOffset); - if (startLine <= captionLine && captionLine < endLine) - return Math.abs(line - captionLine); + int captionLine= document.getLineOfOffset(position.getOffset() + captionOffset); + if (startLine <= captionLine && captionLine < endLine) + return Math.abs(line - captionLine); + } + return line - startLine; } - return line - startLine; } } catch (BadLocationException x) { } |