Attached patch adds support for multiple windows input. To use it apply patch and ./configure --enable-multiinput
Windows can be marked via C-a : multiinput - toggles multi input on current window multiinput n - toggles on nth window Input to all chosen windows occurs only from window which is itself selected to allow normal usage of unselected windows. Chosen windows on the window list are marked with '>'. Amadeusz
diff --git a/src/acconfig.h b/src/acconfig.h index 2e46985..1b174bb 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -140,6 +140,7 @@ * Syntax: screen //telnet host [port] * define RXVT_OSC if you want support for rxvts special * change fgcolor/bgcolor/bgpicture sequences + * define MULTIINPUT if you want to type into multiple windows at once */ #undef SIMPLESCREEN #ifndef SIMPLESCREEN @@ -166,6 +167,7 @@ #undef BUILTIN_TELNET #undef RXVT_OSC #undef COLORS256 +#undef MULTIINPUT /* diff --git a/src/comm.c b/src/comm.c index 5f4af8a..cbbafae 100644 --- a/src/comm.c +++ b/src/comm.c @@ -238,6 +238,9 @@ struct comm comms[RC_LAST + 1] = { "mousetrack", NEED_DISPLAY | ARGS_01 }, { "msgminwait", ARGS_1 }, { "msgwait", ARGS_1 }, +#ifdef MULTIINPUT + { "multiinput", ARGS_01 }, +#endif #ifdef MULTIUSER { "multiuser", ARGS_1 }, #endif diff --git a/src/configure.in b/src/configure.in index e9ca223..9e84bb6 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1281,6 +1281,10 @@ AC_ARG_ENABLE(rxvt_osc, [ --enable-rxvt_osc enable support for rxvt OSC c if test "$enable_rxvt_osc" = "yes"; then AC_DEFINE(RXVT_OSC) fi +AC_ARG_ENABLE(multiinput, [ --enable-multiinput enable multiple windows input support ]) +if test "$enable_multiinput" = "yes"; then + AC_DEFINE(MULTIINPUT) +fi dnl dnl **** the end **** diff --git a/src/process.c b/src/process.c index 70e59f3..0b6e18b 100644 --- a/src/process.c +++ b/src/process.c @@ -1237,6 +1237,31 @@ int key; else if (queryflag >= 0) queryflag = -1; /* ParseWinNum already prints out an appropriate error message. */ break; +#ifdef MULTIINPUT + case RC_MULTIINPUT: + if (!*args) + { + if (!fore) + OutputMsg(0, "multiinput needs a window"); + else + fore->w_miflag = (fore->w_miflag) ? 0 : 1; + } + else + { + if (ParseWinNum(act, &n) == 0) + { + struct win *p; + if ((p = wtab[n]) == 0) + { + ShowWindows(n); + break; + } + else + p->w_miflag = (p->w_miflag) ? 0 : 1; + } + } + break; +#endif #ifdef AUTO_NUKE case RC_DEFAUTONUKE: if (ParseOnOff(act, &defautonuke) == 0 && msgok) @@ -5494,6 +5519,10 @@ struct win *p; } if (p->w_ptyfd < 0 && p->w_type != W_TYPE_GROUP) *s++ = 'Z'; +#ifdef MULTIINPUT + if (p->w_miflag) + *s++ = '>'; +#endif *s = 0; return s; } diff --git a/src/window.c b/src/window.c index 1c6f5b6..8e7bbb9 100644 --- a/src/window.c +++ b/src/window.c @@ -1950,6 +1950,19 @@ char *data; debug2("writing %d bytes to win %d\n", p->w_inlen, p->w_number); if ((len = write(ev->fd, p->w_inbuf, p->w_inlen)) <= 0) len = p->w_inlen; /* dead window */ + +#ifdef MULTIINPUT + struct win *win; + for (win = windows; win; win = win->w_next) + { + if (win != p && p->w_miflag && win->w_miflag) + { + if ((len = write(win->w_ptyfd, p->w_inbuf, p->w_inlen)) <= 0) + len = win->w_inlen; /* dead window */ + } + } +#endif + if ((p->w_inlen -= len)) bcopy(p->w_inbuf + len, p->w_inbuf, p->w_inlen); } diff --git a/src/window.h b/src/window.h index 7311ecb..a1c134a 100644 --- a/src/window.h +++ b/src/window.h @@ -299,6 +299,9 @@ struct win #else int w_exitstatus; #endif +#ifdef MULTIINPUT + int w_miflag; /* multiple windows input flag */ +#endif };