diff --git a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkinBase.fx b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkinBase.fx --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkinBase.fx +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkinBase.fx @@ -157,10 +157,22 @@ p } - protected var textLeft = bind textRegion.padding.left; - protected var textRight = bind textRegion.width - textRegion.padding.right - on replace oldVal { + /** + * Left edge of the text region sans padding + */ + protected var textLeft = bind textRegion.padding.left on replace oldVal { + if (width > 0 and textLeft != oldVal) { + textTranslateX = 0.0; + updateCaretOff(); + } + } + + /** + * Right edge of the text region sans padding + */ + protected var textRight = bind textRegion.width - textRegion.padding.right on replace oldVal { if (width > 0 and textRight != oldVal) { + textTranslateX = 0.0; updateCaretOff(); } } @@ -187,14 +199,13 @@ textTranslateX = Math.min(textTranslateX - delta, 0); } - protected var textRegion:Region; - /** * The content of this text box control skin. It consists of the selection * (highlight) shape, the Text node, and the caret shape, on top of this * root region. Subclasses of TextInputControl may override those functions * in order to create/modify those components with their needs. */ + protected var textRegion:Region; override var content = textRegion = Region { styleClass: "viewport" content: [