@@ -119,7 +119,7 @@ protected void setupDrawText(ModularGuiContext context, WidgetTextFieldTheme wid
119119 this .renderer .setSimulate (false );
120120 this .renderer .setPos (getArea ().getPadding ().getLeft (), getArea ().getPadding ().getTop ());
121121 this .renderer .setScale (this .scale );
122- this .renderer .setAlignment (this .textAlignment , - 1 , getArea ().paddedHeight ());
122+ this .renderer .setAlignment (this .textAlignment , getArea (). paddedWidth () , getArea ().paddedHeight ());
123123 }
124124
125125 protected void drawText (ModularGuiContext context , WidgetTextFieldTheme widgetTheme ) {
@@ -226,7 +226,7 @@ public void onMouseDrag(int mouseButton, long timeSinceClick) {
226226 case Keyboard .KEY_ESCAPE :
227227 if (ModularUIConfig .escRestoreLastText ) {
228228 this .handler .clear ();
229- this .handler .insert (this .lastText );
229+ this .handler .insert (this .lastText , canScrollHorizontally () );
230230 }
231231 getContext ().removeFocus ();
232232 return Result .SUCCESS ;
@@ -267,7 +267,7 @@ public void onMouseDrag(int mouseButton, long timeSinceClick) {
267267 this .handler .delete ();
268268 }
269269 // paste copied text in marked text
270- this .handler .insert (GuiScreen .getClipboardString ().replace ("§" , "" ));
270+ this .handler .insert (GuiScreen .getClipboardString ().replace ("§" , "" ), canScrollHorizontally () );
271271 return Result .SUCCESS ;
272272 } else if (GuiScreen .isKeyComboCtrlX (keyCode ) && this .handler .hasTextMarked ()) {
273273 // copy and delete copied text
@@ -283,12 +283,16 @@ public void onMouseDrag(int mouseButton, long timeSinceClick) {
283283 this .handler .delete ();
284284 }
285285 // insert typed char
286- this .handler .insert (String .valueOf (character ));
286+ this .handler .insert (String .valueOf (character ), canScrollHorizontally () );
287287 return Result .SUCCESS ;
288288 }
289289 return Result .STOP ;
290290 }
291291
292+ public boolean canScrollHorizontally () {
293+ return getScrollArea ().getScrollX () != null ;
294+ }
295+
292296 public int getMaxLines () {
293297 return this .handler .getMaxLines ();
294298 }
0 commit comments