diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index 9a8a443f38bd81232f2b0b18821f916bd7e82292..b39195c888d6034c96ea6d8c7ba58258f10d152b 100644
--- a/pd/src/g_rtext.c
+++ b/pd/src/g_rtext.c
@@ -290,6 +290,10 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
 		        ncolumns = foundit_c;
 			nlines++;
 		}
+		// append new line in case we end our input with an \n
+		if (x->x_buf[x_bufsize_c - 1] == '\n') {
+			nlines++;
+		}
 		if (!reportedindex)
 		    *indexp = outchars_b;
 		dispx = text_xpix(x->x_text, x->x_glist);
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index aa4879748479b8ea280f820e9abed4cc5e783569..d07040c435ff9cb01c6a5cf4787d948ea11deaeb 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -1982,8 +1982,7 @@ void text_eraseborder(t_text *x, t_glist *glist, char *tag)
     glist_eraseiofor(glist, x, tag);
 }
 
-    /* change text; if T_OBJECT, remake it.  LATER we'll have an undo buffer
-    which should be filled in here before making the change. */
+    /* change text; if T_OBJECT, remake it. */
 
 void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos)
 {