Hi All,
I just came across this list yesterday and am glad to see that screen
is still alive and kicking. It's one of those programs I can't
imagine living without.
Anyway, here's a patch I updated recently for version 4.0.2: it adds
two features I use alot. The first I call "toggle" (^aT). Oftentimes
I do many screen commands in a row like creating five or six new
windows. I do ^aT, then c c c c c (to create five more windows).
When I want to cycle through them, I hit the space bar. Or if I want
to go back n forth between windows, then n and p. All this to avoid
hitting ^a every time I want to do a command. When I'm done and want
to return to normal mode, I hit T to turn it off.
The second jumps to the last window in the list (^a$) - like vi's 0 to
go to the front of the line, $ to go to the end.
It also adds an extra check for the -h option - makes sure you can't
pass a non-digit as an argument.
If anyone's interested in the patch, I'll clean it up.
--
Sincerely,
Matt Dunford
diff -ur screen-4.0.2/comm.c my.screen-4.0.2/comm.c
--- screen-4.0.2/comm.c 2003-09-08 10:25:08.000000000 -0400
+++ my.screen-4.0.2/comm.c 2007-02-20 16:17:45.000000000 -0500
@@ -202,6 +202,7 @@
#endif
{ "kill", NEED_FORE|ARGS_0 },
{ "lastmsg", NEED_DISPLAY|ARGS_0 },
+ { "lastwin", ARGS_0 },
{ "license", NEED_LAYER|ARGS_0 },
#ifdef LOCK
{ "lockscreen", NEED_DISPLAY|ARGS_0 },
@@ -299,6 +300,7 @@
{ "terminfo", ARGS_23 },
{ "time", ARGS_01 },
{ "title", NEED_FORE|ARGS_01 },
+ { "toggle", ARGS_0 },
{ "umask", ARGS_1|ARGS_ORMORE },
{ "unsetenv", ARGS_1 },
#ifdef UTF8
Only in my.screen-4.0.2: comm.h
diff -ur screen-4.0.2/comm.h.dist my.screen-4.0.2/comm.h.dist
--- screen-4.0.2/comm.h.dist 2003-12-05 08:50:19.000000000 -0500
+++ my.screen-4.0.2/comm.h.dist 2007-02-20 14:34:50.000000000 -0500
@@ -223,5 +223,7 @@
#define RC_XON 172
#define RC_ZMODEM 173
#define RC_ZOMBIE 174
+#define RC_TOGGLE 175
+#define RC_LASTWIN 176
-#define RC_LAST 174
+#define RC_LAST 176
Only in my.screen-4.0.2: comm.o
Only in my.screen-4.0.2: config.h
Only in my.screen-4.0.2: config.log
Only in my.screen-4.0.2: config.status
Only in my.screen-4.0.2: display.o
Only in my.screen-4.0.2/doc: Makefile
Only in my.screen-4.0.2: encoding.o
diff -ur screen-4.0.2/extern.h my.screen-4.0.2/extern.h
--- screen-4.0.2/extern.h 2003-08-22 08:27:57.000000000 -0400
+++ my.screen-4.0.2/extern.h 2007-02-20 15:57:43.000000000 -0500
@@ -193,6 +193,7 @@
extern int Parse __P((char *, int, char **, int *));
extern void SetEscape __P((struct acluser *, int, int));
extern void DoScreen __P((char *, char **));
+extern int IsNum __P((char *, int));
extern int IsNumColon __P((char *, int, char *, int));
extern void ShowWindows __P((int));
extern char *AddWindows __P((char *, int, int, int));
Only in my.screen-4.0.2: fileio.o
Only in my.screen-4.0.2: help.o
Only in my.screen-4.0.2: input.o
Only in my.screen-4.0.2: kmapdef.c
Only in my.screen-4.0.2: kmapdef.o
Only in my.screen-4.0.2: layer.o
Only in my.screen-4.0.2: loadav.o
Only in my.screen-4.0.2: logfile.o
Only in my.screen-4.0.2: mark.o
Only in my.screen-4.0.2: misc.o
Only in my.screen-4.0.2: nethack.o
Only in my.screen-4.0.2: osdef.h
diff -ur screen-4.0.2/process.c my.screen-4.0.2/process.c
--- screen-4.0.2/process.c 2003-09-18 08:53:54.000000000 -0400
+++ my.screen-4.0.2/process.c 2007-02-20 15:57:44.000000000 -0500
@@ -109,6 +109,7 @@
static void SaveAction __P((struct action *, int, char **, int *));
static int NextWindow __P((void));
static int PreviousWindow __P((void));
+static int LastWindow __P((void));
static int MoreWindows __P((void));
static void LogToggle __P((int));
static void ShowInfo __P((void));
@@ -120,7 +121,6 @@
static int ParseBase __P((struct action *, char *, int *, int, char *));
static int ParseNum1000 __P((struct action *, int *));
static char **SaveArgs __P((char **));
-static int IsNum __P((char *, int));
static void Colonfin __P((char *, int, char *));
static void InputSelect __P((void));
static void InputSetenv __P((char *));
@@ -474,6 +474,8 @@
ktab['q'].nr = ktab[Ctrl('q')].nr = RC_XON;
ktab['s'].nr = ktab[Ctrl('s')].nr = RC_XOFF;
ktab['t'].nr = ktab[Ctrl('t')].nr = RC_TIME;
+ ktab['T'].nr = RC_TOGGLE;
+ ktab['$'].nr = RC_LASTWIN;
ktab['i'].nr = ktab[Ctrl('i')].nr = RC_INFO;
ktab['m'].nr = ktab[Ctrl('m')].nr = RC_LASTMSG;
ktab['A'].nr = RC_TITLE;
@@ -797,7 +799,7 @@
fore = D_fore;
slen = ilen;
s = ibuf;
- if (!D_ESCseen)
+ if (!D_ESCseen && !toggle_key)
{
while (ilen > 0)
{
@@ -1890,6 +1892,13 @@
else
ChangeAKA(fore, *args, strlen(*args));
break;
+ case RC_TOGGLE:
+ toggle_key = !toggle_key;
+ break;
+ case RC_LASTWIN:
+ if (MoreWindows())
+ SwitchWindow(LastWindow());
+ break;
case RC_COLON:
Input(":", 100, INP_COOKED, Colonfin, NULL);
if (*args && **args)
@@ -4370,7 +4379,7 @@
return 0;
}
-static int
+int
IsNum(s, base)
register char *s;
register int base;
@@ -4616,6 +4625,17 @@
}
static int
+LastWindow()
+{
+ int i;
+
+ for (i=MAXWIN-1; i > -1; i--)
+ if (wtab[i])
+ break;
+ return i;
+}
+
+static int
PreviousWindow()
{
register struct win **pp;
Only in my.screen-4.0.2: process.o
Only in my.screen-4.0.2: pty.o
Only in my.screen-4.0.2: putenv.o
Only in my.screen-4.0.2: resize.o
Only in my.screen-4.0.2: sched.o
Only in my.screen-4.0.2: screen
diff -ur screen-4.0.2/screen.c my.screen-4.0.2/screen.c
--- screen-4.0.2/screen.c 2003-09-08 10:26:41.000000000 -0400
+++ my.screen-4.0.2/screen.c 2007-02-20 15:53:39.000000000 -0500
@@ -356,6 +356,8 @@
#ifdef MULTIUSER
char *sockp;
#endif
+extern int toggle_key;
+toggle_key = 0;
#if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX)
setcompat(COMPAT_POSIX|COMPAT_BSDPROT); /* turn on seteuid support */
@@ -574,7 +576,9 @@
case 'h':
if (--ac == 0)
exit_with_usage(myname, NULL, NULL);
- nwin_options.histheight = atoi(*++av);
+ if (!IsNum(*++av, 10))
+ exit_with_usage(myname, "-h: %s: contains a nondigit?", *av);
+ nwin_options.histheight = atoi(*av);
if (nwin_options.histheight < 0)
exit_with_usage(myname, "-h: %s: negative scrollback size?", *av);
break;
diff -ur screen-4.0.2/screen.h my.screen-4.0.2/screen.h
--- screen-4.0.2/screen.h 2003-08-22 08:28:43.000000000 -0400
+++ my.screen-4.0.2/screen.h 2007-02-20 10:34:13.000000000 -0500
@@ -293,3 +293,5 @@
*/
#define WLIST_NUM 0
#define WLIST_MRU 1
+
+int toggle_key;
Only in my.screen-4.0.2: screen.o
Only in my.screen-4.0.2: search.o
Only in my.screen-4.0.2: socket.o
Only in my.screen-4.0.2: tags
Only in my.screen-4.0.2: teln.o
Only in my.screen-4.0.2: term.h
Only in my.screen-4.0.2: term.o
Only in my.screen-4.0.2: termcap.o
Only in my.screen-4.0.2: tty.c
Only in my.screen-4.0.2: tty.o
Only in my.screen-4.0.2: utmp.o
Only in my.screen-4.0.2: window.o
_______________________________________________
screen-users mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/screen-users