Skip to content

Commit 8642aa5

Browse files
tobias-melchermickaelistria
authored andcommitted
InlinedAnnotationDrawingStrategy: ensure verticalDrawingOffset is
greater than zero Fixes: #3119
1 parent 35c23a2 commit 8642aa5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/InlinedAnnotationDrawingStrategy.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,10 @@ protected static void drawAsLeftOf1stCharacter(LineContentAnnotation annotation,
414414
isEndOfLine= false;
415415
}
416416
// When line text has line header annotation, there is a space on the top, adjust the y by using char height
417-
y+= bounds.height - textWidget.getLineHeight();
417+
int verticalDrawingOffset= bounds.height - textWidget.getLineHeight();
418+
if (verticalDrawingOffset > 0) {
419+
y+= verticalDrawingOffset;
420+
}
418421

419422
// Draw the line content annotation
420423
annotation.setLocation(x, y);
@@ -519,7 +522,9 @@ protected static void drawAsRightOfPreviousCharacter(LineContentAnnotation annot
519522

520523
// When line text has line header annotation, there is a space on the top, adjust the y by using char height
521524
int verticalDrawingOffset= charBounds.height - textWidget.getLineHeight();
522-
annotationBounds.y += verticalDrawingOffset;
525+
if (verticalDrawingOffset > 0) {
526+
annotationBounds.y+= verticalDrawingOffset;
527+
}
523528

524529
// Draw the line content annotation
525530
annotation.setLocation(annotationBounds.x, annotationBounds.y);

0 commit comments

Comments
 (0)