From: Jussi Koskela Date: Wed, 20 May 2020 05:15:42 +0000 (+0300) Subject: Counting of pending nodes does not work if null text is saved as "" X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=6d3ac0a19489d85ee5264f860dd757b466eb7b00;p=simantics%2Fplatform.git Counting of pending nodes does not work if null text is saved as "" gitlab #535 Change-Id: Ia4e8a0389659ce115d9cfb8febc23be0061fe3be --- diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java index 77eb78922..bf1bf563b 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java @@ -403,7 +403,7 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L if (hasState(STATE_EDITING)) return; - this.text = new String(text != null ? text : ""); + this.text = text; this.font = font; this.color = color; this.scale = scale; @@ -470,8 +470,8 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L // no value => value if(this.text == null && text != null) NodeUtil.decreasePending(this); - this.text = text != null ? text : ""; - caret = Math.min(caret, this.text.length()); + this.text = text; + caret = text != null ? Math.min(caret, text.length()) : 0; selectionTail = caret; resetCaches();