Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2017-05-23 05:17:46 -0400
committerDani Megert2017-05-23 06:43:43 -0400
commita7f6ec37f4889b1fc268d7331b11275c82583b9c (patch)
tree73f34393a55dbe09720af3ec345e0be21da36992
parent58fb05181030ab9105edb1d26f36f206f74ab4dc (diff)
downloadeclipse.platform.text-a7f6ec37f4889b1fc268d7331b11275c82583b9c.tar.gz
eclipse.platform.text-a7f6ec37f4889b1fc268d7331b11275c82583b9c.tar.xz
eclipse.platform.text-a7f6ec37f4889b1fc268d7331b11275c82583b9c.zip
Change-Id: If2ca0a94f8ae0b58b2d8ef9da714d3b966c87363 Signed-off-by: Dani Megert <daniel_megert@ch.ibm.com>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java30
1 files changed, 7 insertions, 23 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java
index d478be051..4a5bd8eee 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/WhitespaceCharacterPainter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 Wind River Systems, Inc., IBM Corporation and others.
+ * Copyright (c) 2006, 2012 Wind River Systems, Inc., IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -215,13 +215,6 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
*/
private void drawLineRange(GC gc, int startLine, int endLine, int x, int w) {
final int viewPortWidth= fTextWidget.getClientArea().width;
- int spaceCharWidth = gc.stringExtent(" ").x; //$NON-NLS-1$
- boolean optimizeWhitespacePainting = false;
- if ( (spaceCharWidth == gc.stringExtent(String.valueOf(SPACE_SIGN)).x) &&
- (spaceCharWidth == gc.stringExtent(String.valueOf(IDEOGRAPHIC_SPACE_SIGN)).x)) {
- optimizeWhitespacePainting = true;
- }
-
for (int line= startLine; line <= endLine; line++) {
int lineOffset= fTextWidget.getOffsetAtLine(line);
// line end offset including line delimiter
@@ -275,7 +268,7 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
}
// draw character range
if (endOffset > startOffset) {
- drawCharRange(gc, startOffset, endOffset, lineOffset, lineEndOffset, optimizeWhitespacePainting);
+ drawCharRange(gc, startOffset, endOffset, lineOffset, lineEndOffset);
}
}
}
@@ -292,9 +285,8 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
* @param endOffset exclusive end index of the drawing range
* @param lineOffset inclusive start index of the line
* @param lineEndOffset exclusive end index of the line
- * @param optimizeWhitespacePainting <code>true</code> if whitespace painting can be optimized, <code>false</code> otherwise
*/
- private void drawCharRange(GC gc, int startOffset, int endOffset, int lineOffset, int lineEndOffset, boolean optimizeWhitespacePainting) {
+ private void drawCharRange(GC gc, int startOffset, int endOffset, int lineOffset, int lineEndOffset) {
StyledTextContent content= fTextWidget.getContent();
String lineText= content.getTextRange(lineOffset, lineEndOffset - lineOffset);
int startOffsetInLine= startOffset - lineOffset;
@@ -346,12 +338,8 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
visibleChar.append(SPACE_SIGN);
}
}
- // 'continue' improves performance but may produce drawing errors
- // for long runs of space if width of space and dot differ, therefore
- // it can be used only for monospace fonts
- if (optimizeWhitespacePainting) {
- continue;
- }
+ // 'continue' would improve performance but may produce drawing errors
+ // for long runs of space if width of space and dot differ
break;
case '\u3000': // ideographic whitespace
if (isEmptyLine) {
@@ -371,12 +359,8 @@ public class WhitespaceCharacterPainter implements IPainter, PaintListener {
visibleChar.append(IDEOGRAPHIC_SPACE_SIGN);
}
}
- // 'continue' improves performance but may produce drawing errors
- // for long runs of space if width of space and dot differ, therefore
- // it can be used only for monospace fonts
- if (optimizeWhitespacePainting) {
- continue;
- }
+ // 'continue' would improve performance but may produce drawing errors
+ // for long runs of space if width of space and dot differ
break;
case '\t':
if (isEmptyLine) {

Back to the top