Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-11-16 23:05:37 +0000
committerPaul Pazderski2019-11-16 23:28:52 +0000
commitf5e1eb919c96d556117e1d3b821baa6dbd7f47ec (patch)
treeee517836eaf434885be0e47f14b6c6f55cadcb08
parent245f4232129be40954b70f9acbdda6251366724d (diff)
downloadeclipse.platform.text-I20191119-0315.tar.gz
eclipse.platform.text-I20191119-0315.tar.xz
eclipse.platform.text-I20191119-0315.zip
ProjectionRulerColumn Change-Id: I0be673a16d6916b5fce74fd0e7146f906470bbc7 Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java36
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 8c53b21c5..f1db464af 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) {
}

Back to the top