From 1f82f9651eed38705741e9d91c32f5188d917d00 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Sat, 17 Dec 2011 00:15:26 -0500
Subject: [PATCH] added missing undo when text is changed inside message.

---
 src/g_text.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/g_text.c b/src/g_text.c
index 9d4bed9c7..450a1b6f0 100644
--- a/src/g_text.c
+++ b/src/g_text.c
@@ -1844,7 +1844,19 @@ void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos)
             && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd"))
                 canvas_updatewindowlist();
     }
-    else binbuf_text(x->te_binbuf, buf, bufsize);
+    else {
+		binbuf_gettext(x->te_binbuf, &c1, &i1);
+		t_binbuf *b = binbuf_new();
+		binbuf_text(b, buf, bufsize);
+		binbuf_gettext(b, &c2, &i2);
+		if (strcmp(c1, c2)) {
+			canvas_undo_add(glist_getcanvas(glist), 10, "typing",
+				(void *)canvas_undo_set_recreate(glist_getcanvas(glist), &x->te_g, pos));
+			//fprintf(stderr,"blah |%s| |%s|\n", c1, buf);
+		}
+		binbuf_text(x->te_binbuf, buf, bufsize);
+		binbuf_free(b);
+	}
 }
 
     /* this gets called when amessage gets sent to an object whose creation
-- 
GitLab