 +          x = p->w_width;
 +          for( ; *s && x; *d++ = *s++, x-- );
 +          for( ; x; *d++ = ' ', x-- );
++        }
++      else if (in)
++        {
++          CopyInputLine(p->w_savelayer, d, p->w_width);
++          d += p->w_width;
 +        }
 +
 +      /* copy attributes from window image to buffer */

+  register int x, y;
+  struct display *display = p->w_lastdisp;
+  int st = (display && D_status) ? 1 : 0;
+
+  if( p && p->w_mlines )
+    {
+      *d++ = p->w_width;                        /* screen width */
+      *d++ = p->w_height + st;                  /* screen height */
+      *d++ = (st) ? D_status_len : p->w_x;      /* cursor column */
+      *d++ = (st) ? p->w_height : p->w_y;       /* cursor row */
+
+      /* copy window image to buffer */
+      for( y = 0; y < p->w_height; y++ )

       if (calctimeout)
 	timeoutev = calctimo();
       if (timeoutev)
--- input.c.orig	2006-08-09 10:40:10.000000000 -0400
+++ input.c	2006-08-09 11:42:39.000000000 -0400
@@ -400,3 +400,49 @@
   return 0;
 }
 
+#ifdef IPC_EXPORT_IMAGE
+int
+IsInputLayer(l)
+struct layer *l;
+{
+  return l->l_layfn == &InpLf;
+}
+
+int
+GetInputPosition(l)
+struct layer *l;
+{
+  struct inpdata *inpdata = (struct inpdata *)l->l_data;
+  return inpdata->inpstringlen + inpdata->inp.pos;
+}
+
+void
+CopyInputLine(l, dest, width)
+struct layer *l;
+char *dest;
+int width;
+{
+  struct inpdata *inpdata = (struct inpdata *)l->l_data;
+  char *src;
+  int len;
+
+  for
+  ( 
+    src = inpdata->inpstring, len = inpdata->inpstringlen;
+    width && len;
+    *dest++ = *src++, len--, width--
+  );
+
+  if( !(inpdata->inpmode & INP_NOECHO) )
+    {
+      for
+      ( 
+        src = inpdata->inp.buf, len = inpdata->inp.len;
+        width && len;
+        *dest++ = *src++, len--, width--
+      );
+    }
+
+  while( width ) *dest++ = ' ', width--;
+}
+#endif	/* IPC_EXPORT_IMAGE */
--- window.c.orig	2003-12-05 08:45:41.000000000 -0500
+++ window.c	2006-08-09 11:34:20.000000000 -0400
@@ -1993,6 +1993,138 @@
     }
 }
 
