Sfoglia il codice sorgente

Shortcut for empty string offset calculation (e.g. newline) to improv… (#2153)

…e performance


Fixes #1976
Thomas Kutz 7 anni fa
parent
commit
5903b7440a

+ 2 - 0
plugins/org.yakindu.base.xtext.utils.gmf/src/org/yakindu/base/xtext/utils/gmf/figures/SyntaxColoringLabel.java

@@ -172,6 +172,8 @@ public class SyntaxColoringLabel extends WrappingLabel implements MouseMotionLis
 		protected int getTextExtend(Font font, String string) {
 			// Can't use TextUtilities, wrong calculation of " "
 			// getTextUtilities().getStringExtents(string, font).width;
+			if (string.isEmpty())
+				return 0;
 			if (gc.getFont() != font)
 				gc.setFont(font);
 			int offset = gc.textExtent(string).x;