Adding this feature turned out to be pretty easy. If anyone else is
interested, here's a patch that allows you to write a message of the
form "col i\n" to /n/ctl to move window n to the i th column from the
left, starting with 0.

diff -r ad2f6f64fbc8 src/cmd/acme/xfid.c
--- a/src/cmd/acme/xfid.c       Wed Jan 12 00:54:22 2011 -0500
+++ b/src/cmd/acme/xfid.c       Wed Jan 19 03:39:10 2011 -0500
@@ -780,6 +780,26 @@
                if(strncmp(p, "scroll", 6) == 0){       /* turn on automatic 
scrolling
(writes to body only) */
                        w->noscroll = FALSE;
                        m = 6;
+               }else
+               if(strncmp(p, "col ", 4) == 0){
+                       pp = p+4;
+                       m = 4;
+                       q = memchr(pp, '\n', e-pp);
+                       if(q==nil || q==pp){
+                               err = Ebadctl;
+                               break;
+                       }
+                       *q = 0;
+                       i = atoi(pp);
+                       if(i < 0 || i >= row.ncol){
+                               err = Ebadctl;
+                               break;
+                       }
+                       if(row.col[i] != w->col){
+                               colclose(w->col, w, FALSE);
+                               coladd(row.col[i], w, nil, 0);
+                       }
+                       m += (q+1) - pp;
                }else{
                        err = Ebadctl;
                        break;

Reply via email to