Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2021-02-11 21:35:06 +0000
committerMickael Istria2021-02-12 13:42:20 +0000
commit44937a86fdc04c57bac3c36229ac4e394988d096 (patch)
tree84368b1a08c9d1162fff37be7eb69445fe522f40
parentfacba56b7d8518f2075087081fbe3b7e67f02494 (diff)
downloadeclipse.platform.text-44937a86fdc04c57bac3c36229ac4e394988d096.tar.gz
eclipse.platform.text-44937a86fdc04c57bac3c36229ac4e394988d096.tar.xz
eclipse.platform.text-44937a86fdc04c57bac3c36229ac4e394988d096.zip
Bug 571121 - Frequently "editor cheese" with code miningsY20210212-1200I20210212-1840
setLineVerticalIndents may change bounds, so it needs to be called first, before computing redraw bounds. Change-Id: I03181928484454fcdbdc528d871e0fd3005a4e02 Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/InlinedAnnotationDrawingStrategy.java34
1 files changed, 15 insertions, 19 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/InlinedAnnotationDrawingStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/InlinedAnnotationDrawingStrategy.java
index e7d10c2440f..e86801b1a35 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/InlinedAnnotationDrawingStrategy.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/InlinedAnnotationDrawingStrategy.java
@@ -82,16 +82,7 @@ class InlinedAnnotationDrawingStrategy implements IDrawingStrategy {
return;
}
if (gc != null) {
- // Compute the location of the annotation
- Rectangle bounds= textWidget.getTextBounds(offset, offset);
- int x= bounds.x;
- int y= bounds.y;
-
- gc.setBackground(textWidget.getBackground());
-
- // Draw the line header annotation
- annotation.setLocation(x, y);
- annotation.draw(gc, textWidget, offset, length, color, x, y);
+ // Setting vertical indent first, before computing bounds
int height= annotation.getHeight();
if (height != 0) {
if (height != textWidget.getLineVerticalIndent(line)) {
@@ -101,19 +92,24 @@ class InlinedAnnotationDrawingStrategy implements IDrawingStrategy {
textWidget.setLineVerticalIndent(line, height);
}
annotation.oldLine= line;
- return;
} else if (textWidget.getLineVerticalIndent(line) > 0) {
textWidget.setLineVerticalIndent(line, 0);
}
+ // Compute the location of the annotation
+ Rectangle bounds= textWidget.getTextBounds(offset, offset);
+ int x= bounds.x;
+ int y= bounds.y;
+ // Draw the line header annotation
+ gc.setBackground(textWidget.getBackground());
+ annotation.setLocation(x, y);
+ annotation.draw(gc, textWidget, offset, length, color, x, y);
+ } else if (textWidget.getLineVerticalIndent(line) > 0) {
+ // Here vertical indent is done, the redraw of the full line width is done to avoid annotation clipping
+ Rectangle bounds= textWidget.getTextBounds(offset, offset);
+ Rectangle client= textWidget.getClientArea();
+ textWidget.redraw(0, bounds.y, client.width, bounds.height, false);
} else {
- if (textWidget.getLineVerticalIndent(line) > 0) {
- // Here vertical indent is done, the redraw of the full line width is done to avoid annotation clipping
- Rectangle bounds= textWidget.getTextBounds(offset, offset);
- Rectangle client= textWidget.getClientArea();
- textWidget.redraw(0, bounds.y, client.width, bounds.height, false);
- } else {
- textWidget.redrawRange(offset, length, true);
- }
+ textWidget.redrawRange(offset, length, true);
}
}

Back to the top