From c7e380abac167340fd11fc9d9c58b7b142117f3a Mon Sep 17 00:00:00 2001
From: Sojourner Truth <jon.w.wilkes@gmail.com>
Date: Mon, 27 Jun 2016 19:42:45 -0400
Subject: [PATCH] manual merge of aggraef: Reduce console clutter

---
 pd/src/s_inter.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 41d055084..b6e4d129f 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -933,15 +933,26 @@ void gui_end_array(void)
 }
 
 /* Old GUI command interface... */
-void sys_vguid(const char *file, int line, const char *fmt, ...) {
+void sys_vguid(const char *file, int line, const char *fmt, ...)
+{
     va_list ap;
-    char buf[MAXPDSTRING];
+    char buf[MAXPDSTRING], *bufp, *endp;
     va_start(ap, fmt);
     vsnprintf(buf, MAXPDSTRING-1, fmt, ap);
     va_end(ap);
-    /* For old commands, we're just posting them to the pd console */
+    /* Just display the first non-empty line, to remove console clutter. -ag */
+    for (bufp = buf; *bufp && isspace(*bufp); bufp++) ;
+    if ((endp = strchr(bufp, '\n')))
+    {
+        *endp = 0;
+        if (endp[1])
+        {
+            /* Indicate that more stuff follows with an ellipsis. */
+            strncat(bufp, "...", MAXPDSTRING);
+        }
+    }
     gui_vmess("gui_legacy_tcl_command", "sis",
-        file, line, buf);
+        file, line, bufp);
     //sys_vvguid(file,line,fmt,ap);
 }
 
-- 
GitLab