diff options
author | Mickael Istria | 2019-06-27 20:22:43 +0000 |
---|---|---|
committer | Mickael Istria | 2019-06-27 20:22:43 +0000 |
commit | d35e475221bdd306056c199b96afc8f53839e214 (patch) | |
tree | b24425673922ce353ecfbb0119186ff3b881951d /org.eclipse.jface.text/src | |
parent | f6f861584d69ea66be304e03ece940a922bd717a (diff) | |
download | eclipse.platform.text-d35e475221bdd306056c199b96afc8f53839e214.tar.gz eclipse.platform.text-d35e475221bdd306056c199b96afc8f53839e214.tar.xz eclipse.platform.text-d35e475221bdd306056c199b96afc8f53839e214.zip |
Bug 547519 - [code mining] Fix apply on tabulationI20190627-1800
With patch for SWT bug 547519, it's not possible to draw annotations at
the right of a tabulation, just by fixing the char width.
Change-Id: I1432a40f6bd2c25dfe4d11ba40ec278fbd448fa8
Signed-off-by: Mickael Istria <mistria@redhat.com>
Diffstat (limited to 'org.eclipse.jface.text/src')
2 files changed, 4 insertions, 5 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 038b1e215d5..ec8451dbafb 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 @@ -248,8 +248,8 @@ class InlinedAnnotationDrawingStrategy implements IDrawingStrategy { return; } if (gc != null) { - String hostCharacter= textWidget.getText(widgetOffset - 1, widgetOffset - 1); - int redrawnCharacterWidth= gc.stringExtent(hostCharacter).x; + char hostCharacter= textWidget.getText(widgetOffset - 1, widgetOffset - 1).charAt(0); + int redrawnCharacterWidth= hostCharacter != '\t' ? gc.getCharWidth(hostCharacter) : textWidget.getTabs() * gc.getCharWidth(' '); Rectangle charBounds= textWidget.getTextBounds(widgetOffset - 1, widgetOffset - 1); Rectangle annotationBounds= new Rectangle(charBounds.x + redrawnCharacterWidth, charBounds.y, annotation.getWidth(), charBounds.height); @@ -299,7 +299,7 @@ class InlinedAnnotationDrawingStrategy implements IDrawingStrategy { gc.setForeground(textWidget.getSelectionForeground()); gc.setBackground(textWidget.getSelectionBackground()); } - gc.drawString(hostCharacter, charBounds.x, charBounds.y, true); + gc.drawString(Character.toString(hostCharacter), charBounds.x, charBounds.y, true); // END TO REMOVE } else if (style != null && style.metrics != null && style.metrics.width != 0) { // line content annotation had an , reset it diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java index 6a606360b57..699a92d8545 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java @@ -152,8 +152,7 @@ public class LineContentAnnotation extends AbstractInlinedAnnotation { boolean drawRightToPreviousChar(int widgetOffset) { return widgetOffset > 0 && - getTextWidget().getLineAtOffset(widgetOffset) == getTextWidget().getLineAtOffset(widgetOffset - 1) && - getTextWidget().getText().charAt(widgetOffset - 1) != '\t'; // \t workaround bug 547532 + getTextWidget().getLineAtOffset(widgetOffset) == getTextWidget().getLineAtOffset(widgetOffset - 1); } } |