Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-11-16 23:09:40 +0000
committerPaul Pazderski2019-11-16 23:09:40 +0000
commit245f4232129be40954b70f9acbdda6251366724d (patch)
tree9e2b499c99329c7e5dd243dc77f89dcc65224cae
parenta63fd8787e17e771ad042b21b5ab7875b8fb1bf8 (diff)
downloadeclipse.platform.text-245f4232129be40954b70f9acbdda6251366724d.tar.gz
eclipse.platform.text-245f4232129be40954b70f9acbdda6251366724d.tar.xz
eclipse.platform.text-245f4232129be40954b70f9acbdda6251366724d.zip
Bug 347628 - [projection] unfolding doesn't work if caption is last line
in document Change-Id: Ic837b9cb21e1cd00a55764251531e134ebeb5672 Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionRulerColumn.java7
1 files changed, 6 insertions, 1 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 96a705200..8c53b21c5 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,7 +159,12 @@ class ProjectionRulerColumn extends AnnotationRulerColumn {
if (position.getOffset() > -1 && position.getLength() > -1) {
try {
int startLine= document.getLineOfOffset(position.getOffset());
- int endLine= document.getLineOfOffset(position.getOffset() + position.getLength());
+ 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;

Back to the top