diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 206eef9aa13c2209265a695dd2135cd0efc03717..38dbe1b09ab46e4c46a9a433f70c913b7eff602b 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -5822,11 +5822,10 @@ function gui_textarea(cid, tag, type, x, y, width_spec, height_spec, text,
         p.style.setProperty("transform", "translate(0px, " + 
             (zoom > 0 ? 0.5 : 0) + "px)");
         p.style.setProperty("max-width",
-            width_spec !== 0 ? width_spec + "ch" : "60ch");
+            width_spec > 0 ? width_spec + "ch" : "60ch");
         p.style.setProperty("min-width",
-            width_spec <= 0 ? "3ch" :
-                (is_gop == 1 ? (width_spec - 5) + "px" :
-                    width_spec + "ch"));
+                is_gop == 1 ? (width_spec - 5) + "px" :
+                    (width_spec < 0 ? (-width_spec) + "px" : width_spec + "ch"));
         
         // set backgroundimage for message box
         if (type === "msg") {
diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index b82f34701c7dc14e0206fdb1a7f91b4af8ce0f86..c4187861b96ac7f3dc67404914049278a278aa6e 100644
--- a/pd/src/g_rtext.c
+++ b/pd/src/g_rtext.c
@@ -607,7 +607,9 @@ void rtext_activate(t_rtext *x, int state)
     }
     else
     {
-        widthspec = x->x_text->te_width; // width if any specified
+        int xmin, xmax, tmp;
+        gobj_getrect(&x->x_text->te_g, x->x_glist, &xmin, &tmp, &xmax, &tmp);
+        widthspec = (x->x_text->te_width ? x->x_text->te_width : -(xmax-xmin)); // width if any specified
         heightspec = -1; // signal that we don't have a heightspec
         isgop = 0;
     }