From aa4377ecacac309cdfd349035010fd5845b57116 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Wed, 21 Aug 2013 17:25:54 -0400
Subject: [PATCH] *added better way for resizing objects that receive \n as the
 last input character

---
 pd/src/g_rtext.c | 4 ++++
 pd/src/g_text.c  | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index 9a8a443f3..b39195c88 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 aa4879748..d07040c43 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)
 {
-- 
GitLab