From 76edff82efbe2f9c228e33b728d2e5f363c8509c Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sat, 7 Feb 2009 19:44:54 -0500 Subject: Allow highlighting bell/monitor windows in caption The command is 'rendition'. Details in man-page. The defaults are currently set in a way to make sure that the new settings are noticeable. This changeset is preferred over either of the patches in savannah #18382, because it allows specifying the renditions for both bell and monitor windows, and is flexible enough that new renditions can be added if desired. --- src/process.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 929afba..690b677 100644 --- a/src/process.c +++ b/src/process.c @@ -106,6 +106,7 @@ extern char *kmapadef[]; extern char *kmapmdef[]; #endif extern struct mchar mchar_so, mchar_null; +extern int renditions[]; extern int VerboseCreate; #ifdef UTF8 extern char *screenencodings; @@ -3746,6 +3747,36 @@ int key; nattr2color = n; break; #endif + case RC_RENDITION: + i = -1; + if (strcmp(args[0], "bell") == 0) + { + i = REND_BELL; + } + else if (strcmp(args[0], "monitor") == 0) + { + i = REND_MONITOR; + } + else if (strcmp(args[0], "so") != 0) + { + Msg(0, "Invalid option '%s' for rendition", args[0]); + break; + } + + ++args; + ++argl; + + if (i != -1) + { + renditions[i] = ParseAttrColor(args[0], args[1], 1); + WindowChanged((struct win *)0, 'w'); + WindowChanged((struct win *)0, 'W'); + WindowChanged((struct win *)0, 0); + break; + } + + /* We are here, means we want to set the sorendition. */ + /* FALLTHROUGH*/ case RC_SORENDITION: i = 0; if (*args) @@ -3754,6 +3785,7 @@ int key; if (i == -1) break; ApplyAttrColor(i, &mchar_so); + WindowChanged((struct win *)0, 0); debug2("--> %x %x\n", mchar_so.attr, mchar_so.color); } if (msgok) @@ -5238,6 +5270,7 @@ int where; s = ss = buf; for (pp = ((flags & 4) && where >= 0) ? wtab + where + 1: wtab; pp < wtab + MAXWIN; pp++) { + int rend = -1; if (pp - wtab == where && ss == buf) ss = s; if ((p = *pp) == 0) @@ -5258,6 +5291,16 @@ int where; *s++ = ' '; *s++ = ' '; } + if (((flags & 4) && where >= 0 && where < p->w_number) || + (!(flags & 4) && where >= 0 && where > p->w_number)) + { + if (p->w_monitor == MON_DONE && renditions[REND_MONITOR] != -1) + rend = renditions[REND_MONITOR]; + else if ((p->w_bell == BELL_DONE || p->w_bell == BELL_FOUND) && renditions[REND_BELL] != -1) + rend = renditions[REND_BELL]; + } + if (rend != -1) + AddWinMsgRend(s, rend); sprintf(s, "%d", p->w_number); if (p->w_number == where) ss = s; @@ -5273,6 +5316,8 @@ int where; *s++ = ' '; strncpy(s, cmd, l); s += l; + if (rend != -1) + AddWinMsgRend(s, -1); } *s = 0; return ss; -- cgit v1.2.1 From f04882c76d0d23a35942e736e89ef19268f541b5 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sat, 7 Feb 2009 20:00:26 -0500 Subject: Copyright for 2009 --- src/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 690b677..13ed377 100644 --- a/src/process.c +++ b/src/process.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 +/* Copyright (c) 2008, 2009 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Micah Cowan (micah@cowan.name) -- cgit v1.2.1 From a62adf5f7df9bdcabcecba002699af7980dd9203 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sun, 8 Feb 2009 16:14:46 -0500 Subject: Fix the rendition of some specific %w flags. --- src/process.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 13ed377..73a7964 100644 --- a/src/process.c +++ b/src/process.c @@ -5272,7 +5272,11 @@ int where; { int rend = -1; if (pp - wtab == where && ss == buf) - ss = s; + { + ss = s; + if (flags & 8) + break; + } if ((p = *pp) == 0) continue; if ((flags & 1) && display && p == D_fore) @@ -5291,8 +5295,7 @@ int where; *s++ = ' '; *s++ = ' '; } - if (((flags & 4) && where >= 0 && where < p->w_number) || - (!(flags & 4) && where >= 0 && where > p->w_number)) + if (!(flags & 4) || where < 0 || ((flags & 4) && where < p->w_number)) { if (p->w_monitor == MON_DONE && renditions[REND_MONITOR] != -1) rend = renditions[REND_MONITOR]; -- cgit v1.2.1 From 903c7604f7715f0c9453d4e5dba995c2ac927769 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Fri, 13 Feb 2009 22:51:42 -0500 Subject: Customizable digraphs This closes a debian wishlist more than 10 years old (#25096), and also a less old feature request on savannah (#25279). --- src/process.c | 111 +++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 33 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 73a7964..5318b8d 100644 --- a/src/process.c +++ b/src/process.c @@ -154,6 +154,7 @@ static void pass2 __P((char *, int, char *)); static void pow_detach_fn __P((char *, int, char *)); #endif static void digraph_fn __P((char *, int, char *)); +static int digraph_find __P((const char *buf)); static void confirm_fn __P((char *, int, char *)); static int IsOnDisplay __P((struct win *)); static void ResizeRegions __P((char *, int)); @@ -229,9 +230,18 @@ int kmap_extn; static int maptimeout = 300; #endif +#ifndef MAX_DIGRAPH +#define MAX_DIGRAPH 512 +#endif + +struct digraph +{ + unsigned char d[2]; + int value; +}; /* digraph table taken from old vim and rfc1345 */ -static const unsigned char digraphs[][3] = { +static struct digraph digraphs[MAX_DIGRAPH + 1] = { {' ', ' ', 160}, /*   */ {'N', 'S', 160}, /*   */ {'~', '!', 161}, /* ¡ */ @@ -420,6 +430,44 @@ static char *resizeprompts[] = { "resize -l -b # lines: ", }; +static int +parse_input_int(buf, len, val) +const char *buf; +int len; +int *val; +{ + int x = 0, i; + if (len >= 1 && ((*buf == 'U' && buf[1] == '+') || (*buf == '0' && (buf[1] == 'x' || buf[1] == 'X')))) + { + x = 0; + for (i = 2; i < len; i++) + { + if (buf[i] >= '0' && buf[i] <= '9') + x = x * 16 | (buf[i] - '0'); + else if (buf[i] >= 'a' && buf[i] <= 'f') + x = x * 16 | (buf[i] - ('a' - 10)); + else if (buf[i] >= 'A' && buf[i] <= 'F') + x = x * 16 | (buf[i] - ('A' - 10)); + else + return 0; + } + } + else if (buf[0] == '0') + { + x = 0; + for (i = 1; i < len; i++) + { + if (buf[i] < '0' || buf[i] > '7') + return 0; + x = x * 8 | (buf[i] - '0'); + } + } + else + return 0; + *val = x; + return 1; +} + char *noargs[1]; void @@ -3635,6 +3683,20 @@ int key; break; case RC_DIGRAPH: + if (argl && argl[0] > 0 && argl[1] > 0) + { + if (argl[0] != 2) + { + Msg(0, "Two characters expected to define a digraph"); + break; + } + i = digraph_find(args[0]); + digraphs[i].d[0] = args[0][0]; + digraphs[i].d[1] = args[0][1]; + if (!parse_input_int(args[1], argl[1], &digraphs[i].value)) + digraphs[i].value = atoi(args[1]); + break; + } Input("Enter digraph: ", 10, INP_EVERY, digraph_fn, NULL, 0); if (*args && **args) { @@ -6240,6 +6302,18 @@ char *data; } #endif /* PASSWORD */ +static int +digraph_find(buf) +const char *buf; +{ + int i; + for (i = 0; i < MAX_DIGRAPH && digraphs[i].d[0]; i++) + if ((digraphs[i].d[0] == (unsigned char)buf[0] && digraphs[i].d[1] == (unsigned char)buf[1]) || + (digraphs[i].d[0] == (unsigned char)buf[1] && digraphs[i].d[1] == (unsigned char)buf[0])) + break; + return i; +} + static void digraph_fn(buf, len, data) char *buf; @@ -6291,43 +6365,14 @@ char *data; /* dummy */ } if (len < 2) return; - if (len >= 1 && ((*buf == 'U' && buf[1] == '+') || (*buf == '0' && (buf[1] == 'x' || buf[1] == 'X')))) + if (!parse_input_int(buf, len, &x)) { - x = 0; - for (i = 2; i < len; i++) - { - if (buf[i] >= '0' && buf[i] <= '9') - x = x * 16 | (buf[i] - '0'); - else if (buf[i] >= 'a' && buf[i] <= 'f') - x = x * 16 | (buf[i] - ('a' - 10)); - else if (buf[i] >= 'A' && buf[i] <= 'F') - x = x * 16 | (buf[i] - ('A' - 10)); - else - break; - } - } - else if (buf[0] == '0') - { - x = 0; - for (i = 1; i < len; i++) - { - if (buf[i] < '0' || buf[i] > '7') - break; - x = x * 8 | (buf[i] - '0'); - } - } - else - { - for (i = 0; i < (int)(sizeof(digraphs)/sizeof(*digraphs)); i++) - if ((digraphs[i][0] == (unsigned char)buf[0] && digraphs[i][1] == (unsigned char)buf[1]) || - (digraphs[i][0] == (unsigned char)buf[1] && digraphs[i][1] == (unsigned char)buf[0])) - break; - if (i == (int)(sizeof(digraphs)/sizeof(*digraphs))) + i = digraph_find(buf); + if ((x = digraphs[i].value) <= 0) { Msg(0, "Unknown digraph"); return; } - x = digraphs[i][2]; } i = 1; *buf = x; -- cgit v1.2.1 From 35804d79c8a3ee7b2447e4289511c6345e048845 Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Thu, 19 Feb 2009 23:46:36 -0800 Subject: Don't trim the trailing spaces from %-w ! --- src/process.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 5318b8d..ee2f915 100644 --- a/src/process.c +++ b/src/process.c @@ -5334,11 +5334,7 @@ int where; { int rend = -1; if (pp - wtab == where && ss == buf) - { - ss = s; - if (flags & 8) - break; - } + ss = s; if ((p = *pp) == 0) continue; if ((flags & 1) && display && p == D_fore) @@ -5368,7 +5364,11 @@ int where; AddWinMsgRend(s, rend); sprintf(s, "%d", p->w_number); if (p->w_number == where) - ss = s; + { + ss = s; + if (flags & 8) + break; + } s += strlen(s); if (display && p == D_fore) *s++ = '*'; -- cgit v1.2.1 From 5ee7c611dc6b4f2d6228b5f3967fa8adb85ebfaf Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Fri, 20 Feb 2009 13:50:26 -0500 Subject: Fix caption for 'select -' --- src/process.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index ee2f915..66e7cd4 100644 --- a/src/process.c +++ b/src/process.c @@ -5330,6 +5330,11 @@ int where; int l; s = ss = buf; + if ((flags & 8) && where < 0) + { + *s = 0; + return ss; + } for (pp = ((flags & 4) && where >= 0) ? wtab + where + 1: wtab; pp < wtab + MAXWIN; pp++) { int rend = -1; -- cgit v1.2.1 From b4ba7b0a3c5be36050ef0deb68a6b19fd46f501e Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Sun, 22 Feb 2009 00:19:57 -0800 Subject: Don't push bell/monitor attributes onto stack without removing. --- src/process.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 66e7cd4..71c69e1 100644 --- a/src/process.c +++ b/src/process.c @@ -5358,6 +5358,12 @@ int where; *s++ = ' '; *s++ = ' '; } + if (p->w_number == where) + { + ss = s; + if (flags & 8) + break; + } if (!(flags & 4) || where < 0 || ((flags & 4) && where < p->w_number)) { if (p->w_monitor == MON_DONE && renditions[REND_MONITOR] != -1) @@ -5368,12 +5374,6 @@ int where; if (rend != -1) AddWinMsgRend(s, rend); sprintf(s, "%d", p->w_number); - if (p->w_number == where) - { - ss = s; - if (flags & 8) - break; - } s += strlen(s); if (display && p == D_fore) *s++ = '*'; -- cgit v1.2.1 From 01f23034c7abad0e5f3c5cf6dfe51893dc5826e4 Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Thu, 26 Feb 2009 20:17:33 -0800 Subject: Don't segfault on "layout number" when not on a layout (thanks Soliton) --- src/process.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 71c69e1..b5474e7 100644 --- a/src/process.c +++ b/src/process.c @@ -4162,6 +4162,11 @@ int key; { int old; struct layout *lay; + if (!D_layout) + { + Msg(0, "not on a layout"); + break; + } if (!args[1]) { Msg(0, "This is layout %d (%s).\n", D_layout->lay_number, D_layout->lay_title); -- cgit v1.2.1 From d87a0d8f27a979ad1264b3848cc1a2cad0be91c3 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sat, 28 Feb 2009 01:23:00 -0500 Subject: Allow c-style escapes with parameters. With this change, it's possible to use '\n' to represent a new line, instead of '\012' This will be particularly useful for the 'stuff' command. Fixes #25647. --- src/process.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index b5474e7..8fd2fa7 100644 --- a/src/process.c +++ b/src/process.c @@ -4484,7 +4484,7 @@ int bufl, *argl; { if (*p == delim) delim = 0; - else if (delim != '\'' && *p == '\\' && (p[1] == '\'' || p[1] == '"' || p[1] == '\\' || p[1] == '$' || p[1] == '#' || p[1] == '^' || (p[1] >= '0' && p[1] <= '7'))) + else if (delim != '\'' && *p == '\\' && (p[1] == 'n' || p[1] == 'r' || p[1] == 't' || p[1] == '\'' || p[1] == '"' || p[1] == '\\' || p[1] == '$' || p[1] == '#' || p[1] == '^' || (p[1] >= '0' && p[1] <= '7'))) { p++; if (*p >= '0' && *p <= '7') @@ -4503,7 +4503,16 @@ int bufl, *argl; pp++; } else - *pp++ = *p; + { + switch (*p) + { + case 'n': *pp = '\n'; break; + case 'r': *pp = '\r'; break; + case 't': *pp = '\t'; break; + default: *pp = *p; break; + } + pp++; + } } else if (delim != '\'' && *p == '$' && (p[1] == '{' || p[1] == ':' || (p[1] >= 'a' && p[1] <= 'z') || (p[1] >= 'A' && p[1] <= 'Z') || (p[1] >= '0' && p[1] <= '9') || p[1] == '_')) -- cgit v1.2.1 From 9cdf8e20a271dea2c86d571d8ed457ecebbac14c Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Fri, 15 May 2009 15:57:12 -0400 Subject: Improve specifying custom digraphs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this change, instead of using the unicode value to create a custom digraph, it will be possible to use the unicode character itself. For example, digraph >= ≥ instead of digraph >= U+2265 --- src/process.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 8fd2fa7..eb4eeb5 100644 --- a/src/process.c +++ b/src/process.c @@ -3694,7 +3694,32 @@ int key; digraphs[i].d[0] = args[0][0]; digraphs[i].d[1] = args[0][1]; if (!parse_input_int(args[1], argl[1], &digraphs[i].value)) - digraphs[i].value = atoi(args[1]); + { + if (!(digraphs[i].value = atoi(args[1]))) + { + if (!args[1][1]) + digraphs[i].value = (int)args[1][0]; +#ifdef UTF8 + else + { + int t; + unsigned char *s = args[1]; + digraphs[i].value = 0; + while (*s) + { + t = FromUtf8(*s++, &digraphs[i].value); + if (t == -1) + continue; + if (t == -2) + digraphs[i].value = 0; + else + digraphs[i].value = t; + break; + } + } +#endif + } + } break; } Input("Enter digraph: ", 10, INP_EVERY, digraph_fn, NULL, 0); -- cgit v1.2.1 From 6a9b2147844e461515f7cfcea818df297946b63d Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sun, 5 Jul 2009 02:42:01 -0400 Subject: Correctly set the argument length when parsing. Make sure the argument length is set correctly when parsing user input. I think this will fix #26927. --- src/process.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index eb4eeb5..5176a82 100644 --- a/src/process.c +++ b/src/process.c @@ -691,6 +691,7 @@ int create; { kp->ktab[i].nr = RC_ILLEGAL; kp->ktab[i].args = noargs; + kp->ktab[i].argl = 0; } kp->next = 0; *kpp = kp; @@ -3314,6 +3315,7 @@ int key; kme->str = 0; kme->dm.nr = kme->mm.nr = kme->um.nr = RC_ILLEGAL; kme->dm.args = kme->mm.args = kme->um.args = noargs; + kme->dm.argl = kme->mm.argl = kme->um.argl = 0; } i -= 8; kme -= 8; @@ -4477,6 +4479,7 @@ int bufl, *argl; delim = 0; for (;;) { + *lp = 0; while (*p && (*p == ' ' || *p == '\t')) ++p; #ifdef PSEUDOS -- cgit v1.2.1 From 52a0417cf7fe630c60f730a7dd706394c8e55499 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Fri, 24 Jul 2009 12:05:25 +0200 Subject: - fix reattach segfault when size is too small for windowlist - add focus up/down/left/right commands --- src/process.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 4 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 5176a82..fa3d06c 100644 --- a/src/process.c +++ b/src/process.c @@ -162,6 +162,7 @@ static void ResizeFin __P((char *, int, char *)); static struct action *FindKtab __P((char *, int)); static void SelectFin __P((char *, int, char *)); static void SelectLayoutFin __P((char *, int, char *)); +static struct canvas *FindCanvas __P((int, int)); extern struct layer *flayer; @@ -631,7 +632,7 @@ InitKeytab() ktab['\t'].nr = RC_FOCUS; { char *args[2]; - args[0] = "up"; + args[0] = "prev"; args[1] = 0; SaveAction(ktab + T_BACKTAB - T_CAPS + 256, RC_FOCUS, args, 0); } @@ -3932,9 +3933,9 @@ int key; LaySetCursor(); break; case RC_FOCUS: - if (!*args || !strcmp(*args, "down")) + if (!*args || !strcmp(*args, "next")) D_forecv = D_forecv->c_next ? D_forecv->c_next : D_cvlist; - else if (!strcmp(*args, "up")) + else if (!strcmp(*args, "prev")) { struct canvas *cv; for (cv = D_cvlist; cv->c_next && cv->c_next != D_forecv; cv = cv->c_next) @@ -3950,9 +3951,17 @@ int key; ; D_forecv = cv; } + else if (!strcmp(*args, "up")) + D_forecv = FindCanvas(D_forecv->c_xs, D_forecv->c_ys - 1); + else if (!strcmp(*args, "down")) + D_forecv = FindCanvas(D_forecv->c_xs, D_forecv->c_ye + 2); + else if (!strcmp(*args, "left")) + D_forecv = FindCanvas(D_forecv->c_xs - 1, D_forecv->c_ys); + else if (!strcmp(*args, "right")) + D_forecv = FindCanvas(D_forecv->c_xe + 1, D_forecv->c_ys); else { - Msg(0, "%s: usage: focus [up|down|top|bottom]", rc_name); + Msg(0, "%s: usage: focus [next|prev|up|down|left|right|top|bottom]", rc_name); break; } if ((focusminwidth && (focusminwidth < 0 || D_forecv->c_xe - D_forecv->c_xs + 1 < focusminwidth)) || @@ -6768,6 +6777,56 @@ int percent; return done; } +static struct canvas * +FindCanvas(x, y) +int x, y; +{ + struct canvas *cv, *mcv = 0; + int m, mm = 0; + + for (cv = D_cvlist; cv; cv = cv->c_next) + { + /* ye + 1 because of caption line */ + if (x >= cv->c_xs && x <= cv->c_xe && y >= cv->c_ys && y <= cv->c_ye + 1) + return cv; + if (cv == D_forecv) + continue; + m = 0; + if (x >= D_forecv->c_xs && x <= D_forecv->c_xe) + { + if (x < cv->c_xs || x > cv->c_xe) + continue; + if (y < D_forecv->c_ys && y < cv->c_ys) + continue; + if (y > D_forecv->c_ye + 1 && y > cv->c_ye + 1) + continue; + if (y < cv->c_ys) + m = cv->c_ys - y; + if (y > cv->c_ye + 1) + m = y - (cv->c_ye + 1); + } + if (y >= D_forecv->c_ys && y <= D_forecv->c_ye + 1) + { + if (y < cv->c_ys || y > cv->c_ye + 1) + continue; + if (x < D_forecv->c_xs && x < cv->c_xs) + continue; + if (x > D_forecv->c_xe && x > cv->c_xe) + continue; + if (x < cv->c_xs) + m = cv->c_xs - x; + if (x > cv->c_xe) + m = x - cv->c_xe; + } + if (m && (!mm || m < mm)) + { + mcv = cv; + mm = m; + } + } + return mcv ? mcv : D_forecv; +} + static void ResizeRegions(arg, flags) char *arg; -- cgit v1.2.1 From 8147d08647d59aba7accb748c42db2aba3f31bc4 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Wed, 30 Sep 2009 15:54:19 -0400 Subject: 'screen -Q ' to get back results. This is the just the start of querying an existing session. The goal is to allow something like "windows=`screen -Q windows`" in a bash script to get back the results from the 'windows' command. Most of the framework is done. Now the commands need to be updated to specially deal with the queries. --- src/process.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index fa3d06c..1737dcf 100644 --- a/src/process.c +++ b/src/process.c @@ -1144,6 +1144,18 @@ int key; return; } n = comms[nr].flags; + /* XXX: Commands will have a CAN_QUERY flag, depending on whether they have + something to return on a query. For example, 'windows' can return a result, + but 'other' cannot. + */ +#if 0 + if (!(n & CAN_QUERY) && queryflag) + { + /* Query flag is set, but this command cannot be queried. */ + Msg(0, "%s command cannot be queried.", comms[nr].name); + return; + } +#endif if ((n & NEED_DISPLAY) && display == 0) { Msg(0, "%s: %s: display required", rc_name, comms[nr].name); -- cgit v1.2.1 From 9763857d8857a14f2a20c05e5ed552ca47bba3d8 Mon Sep 17 00:00:00 2001 From: Peter Teichman Date: Mon, 9 Nov 2009 12:35:00 -0500 Subject: Support a PID variable during screenrc evaluation. This evaluates to the current SCREEN process id. --- src/process.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index fa3d06c..1875ad8 100644 --- a/src/process.c +++ b/src/process.c @@ -4596,6 +4596,8 @@ int bufl, *argl; sprintf(xbuf, "%d", display ? D_width : -1); else if (!strcmp(ps, "LINES")) sprintf(xbuf, "%d", display ? D_height : -1); + else if (!strcmp(ps, "PID")) + sprintf(xbuf, "%d", getpid()); else v = getenv(ps); } -- cgit v1.2.1 From 0456cfb8bd0fe25c3f78cc15a6f10688eb51aa83 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Mon, 9 Nov 2009 12:45:33 -0500 Subject: Support 'STY' variable to show the session name. --- src/process.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 1875ad8..970b276 100644 --- a/src/process.c +++ b/src/process.c @@ -4598,6 +4598,8 @@ int bufl, *argl; sprintf(xbuf, "%d", display ? D_height : -1); else if (!strcmp(ps, "PID")) sprintf(xbuf, "%d", getpid()); + else if (!strcmp(ps, "STY")) + v = SockName; else v = getenv(ps); } -- cgit v1.2.1 From 1048d3fce2f4fb52eeab0e30466c62925aafcd86 Mon Sep 17 00:00:00 2001 From: Steve Kemp and Gabriel Date: Tue, 10 Nov 2009 10:22:19 -0500 Subject: unbindall command This command will unbind *all* bindings. This can be useful when screen is used solely for its detaching abilities, such as when letting a console application run as a daemon. If, for some reason, it is necessary to bind commands after this, there is always '-X'. Fixes #27745. --- src/process.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 970b276..7553471 100644 --- a/src/process.c +++ b/src/process.c @@ -1398,6 +1398,15 @@ int key; Msg(0, "zmodem mode is %s", zmodes[zmodem_mode]); break; #endif + case RC_UNBINDALL: + { + register unsigned int i; + + for (i = 0; i < sizeof(ktab)/sizeof(*ktab); i++) + ClearAction(&ktab[i]); + Msg(0, "Unbound all keys." ); + break; + } case RC_ZOMBIE: { if (!(s = *args)) -- cgit v1.2.1 From fe5ff3987224b31ca0f9fe9950b661870ec174d8 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Wed, 11 Nov 2009 16:46:40 -0500 Subject: Refactor some code. --- src/process.c | 134 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 75 insertions(+), 59 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 7553471..219a432 100644 --- a/src/process.c +++ b/src/process.c @@ -162,7 +162,6 @@ static void ResizeFin __P((char *, int, char *)); static struct action *FindKtab __P((char *, int)); static void SelectFin __P((char *, int, char *)); static void SelectLayoutFin __P((char *, int, char *)); -static struct canvas *FindCanvas __P((int, int)); extern struct layer *flayer; @@ -3942,63 +3941,37 @@ int key; LaySetCursor(); break; case RC_FOCUS: - if (!*args || !strcmp(*args, "next")) - D_forecv = D_forecv->c_next ? D_forecv->c_next : D_cvlist; - else if (!strcmp(*args, "prev")) - { - struct canvas *cv; - for (cv = D_cvlist; cv->c_next && cv->c_next != D_forecv; cv = cv->c_next) - ; - D_forecv = cv; - } - else if (!strcmp(*args, "top")) - D_forecv = D_cvlist; - else if (!strcmp(*args, "bottom")) - { - struct canvas *cv; - for (cv = D_cvlist; cv->c_next; cv = cv->c_next) - ; - D_forecv = cv; - } - else if (!strcmp(*args, "up")) - D_forecv = FindCanvas(D_forecv->c_xs, D_forecv->c_ys - 1); - else if (!strcmp(*args, "down")) - D_forecv = FindCanvas(D_forecv->c_xs, D_forecv->c_ye + 2); - else if (!strcmp(*args, "left")) - D_forecv = FindCanvas(D_forecv->c_xs - 1, D_forecv->c_ys); - else if (!strcmp(*args, "right")) - D_forecv = FindCanvas(D_forecv->c_xe + 1, D_forecv->c_ys); - else - { - Msg(0, "%s: usage: focus [next|prev|up|down|left|right|top|bottom]", rc_name); - break; - } - if ((focusminwidth && (focusminwidth < 0 || D_forecv->c_xe - D_forecv->c_xs + 1 < focusminwidth)) || - (focusminheight && (focusminheight < 0 || D_forecv->c_ye - D_forecv->c_ys + 1 < focusminheight))) - { - ResizeCanvas(&D_canvas); - RecreateCanvasChain(); - RethinkDisplayViewports(); - ResizeLayersToCanvases(); /* redisplays */ - } - fore = D_fore = Layer2Window(D_forecv->c_layer); - if (D_other == fore) - D_other = 0; - flayer = D_forecv->c_layer; -#ifdef RXVT_OSC - if (D_xtermosc[2] || D_xtermosc[3]) - { - Activate(-1); - break; - } -#endif - RefreshHStatus(); -#ifdef RXVT_OSC - RefreshXtermOSC(); -#endif - flayer = D_forecv->c_layer; - CV_CALL(D_forecv, LayRestore();LaySetCursor()); - WindowChanged(0, 'F'); + { + struct canvas *cv = 0; + if (!*args || !strcmp(*args, "next")) + cv = D_forecv->c_next ? D_forecv->c_next : D_cvlist; + else if (!strcmp(*args, "prev")) + { + for (cv = D_cvlist; cv->c_next && cv->c_next != D_forecv; cv = cv->c_next) + ; + } + else if (!strcmp(*args, "top")) + cv = D_cvlist; + else if (!strcmp(*args, "bottom")) + { + for (cv = D_cvlist; cv->c_next; cv = cv->c_next) + ; + } + else if (!strcmp(*args, "up")) + cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ys - 1); + else if (!strcmp(*args, "down")) + cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ye + 2); + else if (!strcmp(*args, "left")) + cv = FindCanvas(D_forecv->c_xs - 1, D_forecv->c_ys); + else if (!strcmp(*args, "right")) + cv = FindCanvas(D_forecv->c_xe + 1, D_forecv->c_ys); + else + { + Msg(0, "%s: usage: focus [next|prev|up|down|left|right|top|bottom]", rc_name); + break; + } + SetForeCanvas(display, cv); + } break; case RC_RESIZE: i = 0; @@ -6790,7 +6763,7 @@ int percent; return done; } -static struct canvas * +struct canvas * FindCanvas(x, y) int x, y; { @@ -7022,6 +6995,49 @@ char *data; buf[len] = '\034'; } +void +SetForeCanvas(d, cv) +struct display *d; +struct canvas *cv; +{ + struct display *odisplay = display; + if (d->d_forecv == cv) + return; + + display = d; + D_forecv = cv; + if ((focusminwidth && (focusminwidth < 0 || D_forecv->c_xe - D_forecv->c_xs + 1 < focusminwidth)) || + (focusminheight && (focusminheight < 0 || D_forecv->c_ye - D_forecv->c_ys + 1 < focusminheight))) + { + ResizeCanvas(&D_canvas); + RecreateCanvasChain(); + RethinkDisplayViewports(); + ResizeLayersToCanvases(); /* redisplays */ + } + fore = D_fore = Layer2Window(D_forecv->c_layer); + if (D_other == fore) + D_other = 0; + flayer = D_forecv->c_layer; +#ifdef RXVT_OSC + if (D_xtermosc[2] || D_xtermosc[3]) + { + Activate(-1); + } + else +#endif + { + RefreshHStatus(); +#ifdef RXVT_OSC + RefreshXtermOSC(); +#endif + flayer = D_forecv->c_layer; + CV_CALL(D_forecv, LayRestore();LaySetCursor()); + WindowChanged(0, 'F'); + } + + display = odisplay; +} + #ifdef RXVT_OSC void RefreshXtermOSC() -- cgit v1.2.1 From ca20b068fd39f8f9ca0c67353bc2b87141d0d290 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Thu, 12 Nov 2009 12:49:52 -0500 Subject: Add support for mouse tracking. Mouse tracking can be turned on/off using 'mousetrack' command. With mouse-tracking turned on, it is possible to switch to a region ('focus') using mouse-clicks. --- src/process.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 219a432..8136fd5 100644 --- a/src/process.c +++ b/src/process.c @@ -75,6 +75,7 @@ extern char *printcmd; extern int default_startup; extern int defobuflimit; extern int defnonblock; +extern int defmousetrack; extern int ZombieKey_destroy; extern int ZombieKey_resurrect; extern int ZombieKey_onerror; @@ -2727,6 +2728,22 @@ int key; if (ParseOnOff(act, &n) == 0) nwin_default.monitor = (n == 0) ? MON_OFF : MON_ON; break; + case RC_DEFMOUSETRACK: + if (ParseOnOff(act, &n) == 0) + defmousetrack = (n == 0) ? 0 : 1000; + break; + case RC_MOUSETRACK: + if (!args[0]) + { + Msg(0, "Mouse tracking for this display is turned %s", D_mousetrack ? "on" : "off"); + } + else if (ParseOnOff(act, &n) == 0) + { + D_mousetrack = n == 0 ? 0 : 1000; + if (D_fore) + MouseMode(D_fore->w_mouse); + } + break; case RC_DEFSILENCE: if (ParseOnOff(act, &n) == 0) nwin_default.silence = (n == 0) ? SILENCE_OFF : SILENCE_ON; -- cgit v1.2.1 From 827243a5521df50824f0371f24a67692d11fe101 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Thu, 12 Nov 2009 13:42:55 -0500 Subject: Start refactoring. The Screen code at this stage is somewhat complicated to start working on. So refactor some code so it's easier to manage and hack. Also, the plan is to eventually add some documentation, possibly in the header files showing their usage. --- src/process.c | 163 +--------------------------------------------------------- 1 file changed, 1 insertion(+), 162 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 8136fd5..fda3a8e 100644 --- a/src/process.c +++ b/src/process.c @@ -49,6 +49,7 @@ #include "screen.h" #include "extern.h" #include "logfile.h" +#include "canvas.h" extern struct comm comms[]; extern char *rc_name; @@ -5006,118 +5007,6 @@ int n; Activate(fore->w_norefresh); } - -void -SetCanvasWindow(cv, wi) -struct canvas *cv; -struct win *wi; -{ - struct win *p = 0, **pp; - struct layer *l; - struct canvas *cvp, **cvpp; - - l = cv->c_layer; - display = cv->c_display; - - if (l) - { - /* remove old layer */ - for (cvpp = &l->l_cvlist; (cvp = *cvpp); cvpp = &cvp->c_lnext) - if (cvp == cv) - break; - ASSERT(cvp); - *cvpp = cvp->c_lnext; - - p = Layer2Window(l); - l = cv->c_layer; - cv->c_layer = 0; - - if (p && cv == D_forecv) - { -#ifdef MULTIUSER - ReleaseAutoWritelock(display, p); -#endif - if (p->w_silence) - { - SetTimeout(&p->w_silenceev, p->w_silencewait * 1000); - evenq(&p->w_silenceev); - } - D_other = fore; - D_fore = 0; - } - if (l->l_cvlist == 0 && (p == 0 || l != p->w_savelayer)) - KillLayerChain(l); - } - - /* find right layer to display on canvas */ - if (wi && wi->w_type != W_TYPE_GROUP) - { - l = &wi->w_layer; - if (wi->w_savelayer && (wi->w_blocked || wi->w_savelayer->l_cvlist == 0)) - l = wi->w_savelayer; - } - else - { - l = &cv->c_blank; - if (wi) - l->l_data = (char *)wi; - else - l->l_data = 0; - } - - /* add our canvas to the layer's canvaslist */ - ASSERT(l->l_cvlist != cv); - cv->c_lnext = l->l_cvlist; - l->l_cvlist = cv; - cv->c_layer = l; - cv->c_xoff = cv->c_xs; - cv->c_yoff = cv->c_ys; - RethinkViewportOffsets(cv); - - if (flayer == 0) - flayer = l; - - if (wi && wi->w_type == W_TYPE_GROUP) - { - /* auto-start windowlist on groups */ - struct display *d = display; - struct layer *oldflayer = flayer; - flayer = l; - display_wlist(0, 0, wi); - flayer = oldflayer; - display = d; - } - - if (wi && D_other == wi) - D_other = wi->w_next; /* Might be 0, but that's OK. */ - if (cv == D_forecv) - { - D_fore = wi; - fore = D_fore; /* XXX ? */ - if (wi) - { -#ifdef MULTIUSER - ObtainAutoWritelock(display, wi); -#endif - /* - * Place the window at the head of the most-recently-used list - */ - if (windows != wi) - { - for (pp = &windows; (p = *pp); pp = &p->w_next) - if (p == wi) - break; - ASSERT(p); - *pp = p->w_next; - p->w_next = windows; - windows = p; - WListLinkChanged(); - } - } - } -} - - /* * SetForeWindow changes the window in the input focus of the display. * Puts window wi in canvas display->d_forecv. @@ -6780,56 +6669,6 @@ int percent; return done; } -struct canvas * -FindCanvas(x, y) -int x, y; -{ - struct canvas *cv, *mcv = 0; - int m, mm = 0; - - for (cv = D_cvlist; cv; cv = cv->c_next) - { - /* ye + 1 because of caption line */ - if (x >= cv->c_xs && x <= cv->c_xe && y >= cv->c_ys && y <= cv->c_ye + 1) - return cv; - if (cv == D_forecv) - continue; - m = 0; - if (x >= D_forecv->c_xs && x <= D_forecv->c_xe) - { - if (x < cv->c_xs || x > cv->c_xe) - continue; - if (y < D_forecv->c_ys && y < cv->c_ys) - continue; - if (y > D_forecv->c_ye + 1 && y > cv->c_ye + 1) - continue; - if (y < cv->c_ys) - m = cv->c_ys - y; - if (y > cv->c_ye + 1) - m = y - (cv->c_ye + 1); - } - if (y >= D_forecv->c_ys && y <= D_forecv->c_ye + 1) - { - if (y < cv->c_ys || y > cv->c_ye + 1) - continue; - if (x < D_forecv->c_xs && x < cv->c_xs) - continue; - if (x > D_forecv->c_xe && x > cv->c_xe) - continue; - if (x < cv->c_xs) - m = cv->c_xs - x; - if (x > cv->c_xe) - m = x - cv->c_xe; - } - if (m && (!mm || m < mm)) - { - mcv = cv; - mm = m; - } - } - return mcv ? mcv : D_forecv; -} - static void ResizeRegions(arg, flags) char *arg; -- cgit v1.2.1 From 36983385404db06b71744d9d42fbdd6d1c105bc2 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Thu, 12 Nov 2009 14:24:12 -0500 Subject: Refactor 'layout' and 'viewport' --- src/process.c | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index fda3a8e..27877c2 100644 --- a/src/process.c +++ b/src/process.c @@ -49,7 +49,8 @@ #include "screen.h" #include "extern.h" #include "logfile.h" -#include "canvas.h" +#include "layout.h" +#include "viewport.h" extern struct comm comms[]; extern char *rc_name; @@ -5135,36 +5136,6 @@ MoreWindows() return 0; } -static void -UpdateLayoutCanvas(cv, wi) -struct canvas *cv; -struct win *wi; -{ - for (; cv; cv = cv->c_slnext) - { - if (cv->c_layer && Layer2Window(cv->c_layer) == wi) - { - /* A simplistic version of SetCanvasWindow(cv, 0) */ - struct layer *l = cv->c_layer; - cv->c_layer = 0; - if (l->l_cvlist == 0 && (wi == 0 || l != wi->w_savelayer)) - KillLayerChain(l); - l = &cv->c_blank; - l->l_data = 0; - if (l->l_cvlist != cv) - { - cv->c_lnext = l->l_cvlist; - l->l_cvlist = cv; - } - cv->c_layer = l; - /* Do not end here. Multiple canvases can have the same window */ - } - - if (cv->c_slperp) - UpdateLayoutCanvas(cv->c_slperp, wi); - } -} - void KillWindow(wi) struct win *wi; -- cgit v1.2.1 From 2199ead34441dd5291ffecb737b9ff4e7ae47f0d Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sat, 5 Dec 2009 21:53:52 -0500 Subject: Revamp the display list. Revamp the display list (in works). The future changes are expected to add full mouse control, and perhaps some other utility functions (e.g. detaching a display, changing permissions perhaps? etc.) --- src/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 27877c2..8788ea8 100644 --- a/src/process.c +++ b/src/process.c @@ -6338,7 +6338,7 @@ int i; fore = D_fore; act = 0; #ifdef COPY_PASTE - if (InMark() || InInput() || InWList()) + if (flayer && flayer->l_mode == 1) act = i < KMAP_KEYS+KMAP_AKEYS ? &mmtab[i] : &kmap_exts[i - (KMAP_KEYS+KMAP_AKEYS)].mm; #endif if ((!act || act->nr == RC_ILLEGAL) && !D_mapdefault) -- cgit v1.2.1 From 0dc3a24b7bd949dc2c1709416b580828baea5b5f Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Fri, 11 Dec 2009 17:29:48 -0500 Subject: New 'dump' subcommand for 'layout'. This command will write a series of screen commands that can later be used to recreate the current layout. I think this will be pretty useful. Users like to create a layout interactively, and use it again for the next session etc. --- src/process.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 8788ea8..2874e7e 100644 --- a/src/process.c +++ b/src/process.c @@ -4367,6 +4367,15 @@ int key; if (lay) RemoveLayout(lay); } + else if (!strcmp(args[0], "dump")) + { + if (!display) + Msg(0, "Must have a display for 'layout dump'."); + else if (!LayoutDumpCanvas(&D_canvas, args[1] ? args[1] : "layout-dump")) + Msg(errno, "Error dumping layout."); + else + Msg(0, "Layout dumped to \"%s\"", args[1] ? args[1] : "layout-dump"); + } else Msg(0, "unknown layout subcommand"); break; -- cgit v1.2.1 From 1e4fb57b49754618dc147f397a8a72483fd6c419 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 15 Dec 2009 12:59:18 -0500 Subject: Allow adding visual notification in caption string. '%P' in caption string will set '%?' to true if the current region is in copy/paste mode. So, if you want to simply change the color etc. of your caption, prepend '%?%P%{XXX}%?' to your caption and you're set ('XXX' stands for the usual attribute/color modifier). If, on the other hand, you want to change the caption string in copy mode, change your caption string to '%?%PCaption for copy mode%:Your usual caption%?'. --- src/process.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 2874e7e..0e835f0 100644 --- a/src/process.c +++ b/src/process.c @@ -2231,6 +2231,7 @@ int key; break; } MarkRoutine(); + WindowChanged(fore, 'P'); break; case RC_HISTORY: { -- cgit v1.2.1 From 52efeb8dfc40be5d5ba36253a1dc3af514d0b226 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sat, 19 Dec 2009 14:23:27 -0500 Subject: Allow no argument to blankerprg. Without any argument, blankerprg will show the command that would be executed on 'blanker'. To unset, use an empty string, i.e. "blankerprg ''". --- src/process.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 0e835f0..76785e1 100644 --- a/src/process.c +++ b/src/process.c @@ -4088,6 +4088,21 @@ int key; break; #ifdef BLANKER_PRG case RC_BLANKERPRG: + if (!args[0]) + { + if (blankerprg) + { + char path[MAXPATHLEN]; + char *p = path, **pp; + for (pp = blankerprg; *pp; pp++) + p += snprintf(p, sizeof(path) - (p - path) - 1, "%s ", *pp); + *(p - 1) = '\0'; + Msg(0, "blankerprg: %s", path); + } + else + Msg(0, "No blankerprg set."); + break; + } if (blankerprg) { char **pp; -- cgit v1.2.1 From 4b778782ce398747f080b7b7ffd8a2e26c3b0a88 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sun, 20 Dec 2009 00:14:15 -0500 Subject: Allow 'at' command for windows without a display. For window-context, 'at' commands can work without any existing display. So allow for that. If the command specified for 'at' requires a display, then that will still fail, as it should. But for some commands, just an existing window is enough. Fixes savannah bug #26996. --- src/process.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 76785e1..70bb4fa 100644 --- a/src/process.c +++ b/src/process.c @@ -1451,12 +1451,14 @@ int key; break; case RC_AT: /* where this AT command comes from: */ + if (!user) + break; #ifdef MULTIUSER - s = SaveStr(D_user->u_name); + s = SaveStr(user->u_name); /* DO NOT RETURN FROM HERE WITHOUT RESETTING THIS: */ - EffectiveAclUser = D_user; + EffectiveAclUser = user; #else - s = SaveStr(D_usertty); + s = SaveStr(display ? D_usertty : user->u_name); #endif n = strlen(args[0]); if (n) n--; @@ -1473,14 +1475,22 @@ int key; struct acluser *u; if (!n) - u = D_user; + u = user; else - for (u = users; u; u = u->u_next) - { - debug3("strncmp('%s', '%s', %d)\n", *args, u->u_name, n); - if (!strncmp(*args, u->u_name, n)) + { + for (u = users; u; u = u->u_next) + { + debug3("strncmp('%s', '%s', %d)\n", *args, u->u_name, n); + if (!strncmp(*args, u->u_name, n)) + break; + } + if (!u) + { + args[0][n] = '\0'; + Msg(0, "Did not find any user matching '%s'", args[0]); break; - } + } + } debug1("at all displays of user %s\n", u->u_name); for (display = displays; display; display = nd) { @@ -1539,7 +1549,7 @@ int key; struct win *nw; int ch; - n++; + n++; ch = args[0][n]; args[0][n] = '\0'; if (!*args[0] || (i = WindowByNumber(args[0])) < 0) -- cgit v1.2.1 From f33e5cdecb7bf3b6ae8e4a5c0ca394dd5a06a416 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 26 Jan 2010 15:15:24 -0500 Subject: Increase the max-window limit. The limit can be increased using the 'maxwin' command. There is still an upper-limit of 2048 windows. --- src/process.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 70bb4fa..b67afd5 100644 --- a/src/process.c +++ b/src/process.c @@ -186,7 +186,7 @@ extern int nethackflag; #endif -struct win *wtab[MAXWIN]; /* window table, should be dynamic */ +extern struct win **wtab; #ifdef MULTIUSER extern char *multi; @@ -586,7 +586,7 @@ InitKeytab() args[1] = NULL; SaveAction(ktab + '-', RC_SELECT, args, 0); } - for (i = 0; i < ((MAXWIN < 10) ? MAXWIN : 10); i++) + for (i = 0; i < ((maxwin < 10) ? maxwin : 10); i++) { char *args[2], arg1[10]; args[0] = arg1; @@ -991,7 +991,7 @@ struct paster *pa; int FindCommnr(str) -char *str; +const char *str; { int x, m, l = 0, r = RC_LAST; while (l <= r) @@ -1588,7 +1588,7 @@ int key; Msg(0, "%s: at '%s': no such window.\n", rc_name, args[0]); break; } - else if (i < MAXWIN && (fore = wtab[i])) + else if (i < maxwin && (fore = wtab[i])) { args[0][n] = ch; /* must restore string in case of bind */ debug2("AT window %d (%s)\n", fore->w_number, fore->w_title); @@ -4054,14 +4054,25 @@ int key; Msg(0, "Will %sdo alternate screen switching", use_altscreen ? "" : "not "); break; case RC_MAXWIN: + if (!args[0]) + { + Msg(0, "maximum windows allowed: %d", maxwin); + break; + } if (ParseNum(act, &n)) break; if (n < 1) Msg(0, "illegal maxwin number specified"); - else if (n > maxwin) - Msg(0, "may only decrease maxwin number"); + else if (n > 2048) + Msg(0, "maximum 2048 windows allowed"); + else if (n > maxwin && windows) + Msg(0, "may increase maxwin only when there's no window"); else - maxwin = n; + { + if (!windows) + wtab = realloc(wtab, n * sizeof(struct win)); + maxwin = n; + } break; case RC_BACKTICK: if (ParseBase(act, *args, &n, 10, "decimal")) @@ -4435,10 +4446,11 @@ char **argv; int *argl; { struct action act; + const char *cmd = *argv; - if ((act.nr = FindCommnr(*argv)) == RC_ILLEGAL) + if ((act.nr = FindCommnr(cmd)) == RC_ILLEGAL) { - Msg(0, "%s: unknown command '%s'", rc_name, *argv); + Msg(0, "%s: unknown command '%s'", rc_name, cmd); return; } act.args = argv + 1; @@ -4907,7 +4919,7 @@ char *str; int i; struct win *p; - if ((i = WindowByNumber(str)) < 0 || i >= MAXWIN) + if ((i = WindowByNumber(str)) < 0 || i >= maxwin) { if ((p = WindowByName(str))) return p->w_number; @@ -5012,7 +5024,7 @@ int n; struct win *p; debug1("SwitchWindow %d\n", n); - if (n < 0 || n >= MAXWIN) + if (n < 0 || n >= maxwin) { ShowWindows(-1); return; @@ -5116,12 +5128,12 @@ static int NextWindow() { register struct win **pp; - int n = fore ? fore->w_number : MAXWIN; + int n = fore ? fore->w_number : maxwin; struct win *group = fore ? fore->w_group : 0; for (pp = fore ? wtab + n + 1 : wtab; pp != wtab + n; pp++) { - if (pp == wtab + MAXWIN) + if (pp == wtab + maxwin) pp = wtab; if (*pp) { @@ -5144,7 +5156,7 @@ PreviousWindow() for (pp = wtab + n - 1; pp != wtab + n; pp--) { if (pp == wtab - 1) - pp = wtab + MAXWIN - 1; + pp = wtab + maxwin - 1; if (*pp) { if (!fore || group == (*pp)->w_group) @@ -5284,7 +5296,7 @@ int where; *s = 0; return ss; } - for (pp = ((flags & 4) && where >= 0) ? wtab + where + 1: wtab; pp < wtab + MAXWIN; pp++) + for (pp = ((flags & 4) && where >= 0) ? wtab + where + 1: wtab; pp < wtab + maxwin; pp++) { int rend = -1; if (pp - wtab == where && ss == buf) @@ -5921,7 +5933,7 @@ char *fn, **av; if (*buf != '\0') nwin.aka = buf; num = atoi(*av); - if (num < 0 || num > MAXWIN - 1) + if (num < 0 || num > maxwin - 1) { Msg(0, "%s: illegal screen number %d.", fn, num); num = 0; -- cgit v1.2.1 From f3415774783781be919cd0452d401bbbe396c879 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Mon, 8 Feb 2010 21:19:24 -0500 Subject: Fix escape-# to select windows this time. --- src/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index b67afd5..0bb3603 100644 --- a/src/process.c +++ b/src/process.c @@ -586,7 +586,7 @@ InitKeytab() args[1] = NULL; SaveAction(ktab + '-', RC_SELECT, args, 0); } - for (i = 0; i < ((maxwin < 10) ? maxwin : 10); i++) + for (i = 0; i < ((maxwin && maxwin < 10) ? maxwin : 10); i++) { char *args[2], arg1[10]; args[0] = arg1; -- cgit v1.2.1 From b040667633ecccb582426536936f07c8e005c87b Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Fri, 12 Feb 2010 16:26:16 -0500 Subject: Put in some flags to suppress messages from commands. A command name can be prefixed by '@' to suppress the error messages, and by '-' to suppress the normal messages. The flags are currently parsed, but not acted upon. --- src/process.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 0bb3603..42da498 100644 --- a/src/process.c +++ b/src/process.c @@ -695,6 +695,7 @@ int create; kp->ktab[i].nr = RC_ILLEGAL; kp->ktab[i].args = noargs; kp->ktab[i].argl = 0; + kp->ktab[i].quiet = 0; } kp->next = 0; *kpp = kp; @@ -4448,6 +4449,18 @@ int *argl; struct action act; const char *cmd = *argv; + act.quiet = 0; + if (*cmd == '@') /* Suppress error */ + { + act.quiet |= 0x01; + cmd++; + } + if (*cmd == '-') /* Suppress normal message */ + { + act.quiet |= 0x02; + cmd++; + } + if ((act.nr = FindCommnr(cmd)) == RC_ILLEGAL) { Msg(0, "%s: unknown command '%s'", rc_name, cmd); @@ -6125,6 +6138,7 @@ char *data; act.nr = *(int *)data; act.args = noargs; act.argl = 0; + act.quiet = 0; DoAction(&act, -1); } -- cgit v1.2.1 From 9756ae6fb21fb6421e543173115059d36358c692 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Fri, 12 Feb 2010 16:38:38 -0500 Subject: Get rid of compile-time warnings. --- src/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 42da498..128b0e2 100644 --- a/src/process.c +++ b/src/process.c @@ -26,6 +26,8 @@ **************************************************************** */ +#include "config.h" + #include #include #include @@ -39,8 +41,6 @@ #endif -#include "config.h" - /* for solaris 2.1, Unixware (SVR4.2) and possibly others: */ #ifdef HAVE_STROPTS_H # include -- cgit v1.2.1 From 929be520ad026011ac98420f4a56fa93dff06899 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 16 Feb 2010 11:00:58 -0500 Subject: Complete the query-response system. Some commands now can be queried from a remote session using the '-Q' flag, e.g. 'screen -Q windows'. The commands will send the response to the stdout of the querying process. If there was an error in the command, then the querying process will exit with a non-zero status. The commands that can be queried now are: echo info lastmsg time title windows --- src/process.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 923565a..5d6941d 100644 --- a/src/process.c +++ b/src/process.c @@ -59,6 +59,7 @@ extern char *BellString, *ActivityString, *ShellProg, *ShellArgs[]; extern char *hstatusstring, *captionstring, *timestring; extern char *wliststr, *wlisttit; extern int captionalways; +extern int queryflag; extern char *hardcopydir, *screenlogfile, *logtstamp_string; extern int log_flush, logtstamp_on, logtstamp_after; extern char *VisualBellString; @@ -1147,31 +1148,35 @@ int key; return; } n = comms[nr].flags; - /* XXX: Commands will have a CAN_QUERY flag, depending on whether they have - something to return on a query. For example, 'windows' can return a result, - but 'other' cannot. + /* Commands will have a CAN_QUERY flag, depending on whether they have + * something to return on a query. For example, 'windows' can return a result, + * but 'other' cannot. + * If some command causes an error, then it should reset queryflag to -1, so that + * the process requesting the query can be notified that an error happened. */ -#if 0 - if (!(n & CAN_QUERY) && queryflag) + if (!(n & CAN_QUERY) && queryflag >= 0) { /* Query flag is set, but this command cannot be queried. */ Msg(0, "%s command cannot be queried.", comms[nr].name); + queryflag = -1; return; } -#endif if ((n & NEED_DISPLAY) && display == 0) { Msg(0, "%s: %s: display required", rc_name, comms[nr].name); + queryflag = -1; return; } if ((n & NEED_FORE) && fore == 0) { Msg(0, "%s: %s: window required", rc_name, comms[nr].name); + queryflag = -1; return; } if ((n & NEED_LAYER) && flayer == 0) { Msg(0, "%s: %s: display or window required", rc_name, comms[nr].name); + queryflag = -1; return; } if ((argc = CheckArgNum(nr, args)) < 0) @@ -1183,6 +1188,7 @@ int key; { Msg(0, "%s: %s: permission denied (user %s)", rc_name, comms[nr].name, (EffectiveAclUser ? EffectiveAclUser : D_user)->u_name); + queryflag = -1; return; } } @@ -2038,6 +2044,13 @@ int key; } break; case RC_TITLE: + if (queryflag >= 0) + { + if (fore) + Msg(0, "%s", fore->w_title); + else + queryflag = -1; + } if (*args == 0) InputAKA(); else @@ -2647,7 +2660,10 @@ int key; if (s) Msg(0, "%s", s); else - Msg(0, "%s: 'echo [-n] [-p] \"string\"' expected.", rc_name); + { + Msg(0, "%s: 'echo [-n] [-p] \"string\"' expected.", rc_name); + queryflag = -1; + } break; case RC_BELL: case RC_BELL_MSG: @@ -5330,7 +5346,7 @@ int where; continue; if ((flags & 1) && display && p == D_fore) continue; - if (D_fore && D_fore->w_group != p->w_group) + if (display && D_fore && D_fore->w_group != p->w_group) continue; cmd = p->w_title; @@ -5472,13 +5488,11 @@ int where; char buf[1024]; char *s, *ss; - if (!display) - return; - if (where == -1 && D_fore) + if (display && where == -1 && D_fore) where = D_fore->w_number; ss = AddWindows(buf, sizeof(buf), 0, where); s = buf + strlen(buf); - if (ss - buf > D_width / 2) + if (display && ss - buf > D_width / 2) { ss -= D_width / 2; if (s - ss < D_width) -- cgit v1.2.1 From 7399960d86d8561aebd68d5fe331b44594decbd0 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 16 Feb 2010 11:27:49 -0500 Subject: Allow querying 'select'. Using this, it will be possible to detect if a particular window exists or not. --- src/process.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 5d6941d..34ed63d 100644 --- a/src/process.c +++ b/src/process.c @@ -1208,7 +1208,10 @@ int key; else if (args[0][0] == '.' && !args[0][1]) { if (!fore) - Msg(0, "select . needs a window"); + { + Msg(0, "select . needs a window"); + queryflag = -1; + } else { SetForeWindow(fore); @@ -1217,6 +1220,8 @@ int key; } else if (ParseWinNum(act, &n) == 0) SwitchWindow(n); + else if (queryflag >= 0) + queryflag = -1; /* ParseWinNum already prints out an appropriate error message. */ break; #ifdef AUTO_NUKE case RC_DEFAUTONUKE: -- cgit v1.2.1 From 6c6d7edccebb2c33abbf461299f2cea99ecb1a17 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 16 Feb 2010 12:45:53 -0500 Subject: Make 'number' query-able. --- src/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 34ed63d..c1d2da1 100644 --- a/src/process.c +++ b/src/process.c @@ -2961,7 +2961,7 @@ int key; break; case RC_NUMBER: if (*args == 0) - Msg(0, "This is window %d (%s).\n", fore->w_number, fore->w_title); + Msg(0, queryflag >= 0 ? "%d (%s)" : "This is window %d (%s).", fore->w_number, fore->w_title); else { int old = fore->w_number; @@ -2984,6 +2984,7 @@ int key; if (n < 0 || n >= maxwin) { Msg(0, "Given window position is invalid."); + queryflag = -1; return; } p = wtab[n]; -- cgit v1.2.1 From b7d33bdc3cc3d60cd23410372f908a8fb5b5a728 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Thu, 18 Feb 2010 14:30:41 -0500 Subject: Fix creating numbered windows. This is another bug introduced when the max number of windows was made configurable. Bug reported by Christian Ebert in <20100218160955.GC21624@krille.blacktrash.org>. And fix a typo. --- src/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index c1d2da1..3ea86cb 100644 --- a/src/process.c +++ b/src/process.c @@ -4105,7 +4105,7 @@ int key; else { if (!windows) - wtab = realloc(wtab, n * sizeof(struct win)); + wtab = realloc(wtab, n * sizeof(struct win *)); maxwin = n; } break; @@ -5978,7 +5978,7 @@ char *fn, **av; if (*buf != '\0') nwin.aka = buf; num = atoi(*av); - if (num < 0 || num > maxwin - 1) + if (num < 0 || (maxwin && num > maxwin - 1) || (!maxwin && num > MAXWIN - 1)) { Msg(0, "%s: illegal screen number %d.", fn, num); num = 0; -- cgit v1.2.1 From 23b17abd7a9f00894f820eeba824623940d26a38 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Thu, 18 Feb 2010 15:20:36 -0500 Subject: Exclude the PID when expanding $STY. Excluding the PID from the expansion of $STY makes it possible to do, e.g. 'source screenrc-$STY' to load session-specific commands. If the PID is desired, for some reason, then '$PID.$STY' should be used instead. --- src/process.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 3ea86cb..e131384 100644 --- a/src/process.c +++ b/src/process.c @@ -4694,7 +4694,12 @@ int bufl, *argl; else if (!strcmp(ps, "PID")) sprintf(xbuf, "%d", getpid()); else if (!strcmp(ps, "STY")) - v = SockName; + { + if ((v = strchr(SockName, '.'))) /* Skip the PID */ + v++; + else + v = SockName; + } else v = getenv(ps); } -- cgit v1.2.1 From c649e67105da3feb4d6d2d48a3d4ec72e484daf4 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Mon, 22 Feb 2010 23:36:30 -0500 Subject: It makes no sense to allow a group into itself. --- src/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index e131384..b12eafb 100644 --- a/src/process.c +++ b/src/process.c @@ -4236,7 +4236,7 @@ int key; if (args[0][0]) { fore->w_group = WindowByName(*args); - if (fore->w_group && fore->w_group->w_type != W_TYPE_GROUP) + if (fore->w_group == fore || (fore->w_group && fore->w_group->w_type != W_TYPE_GROUP)) fore->w_group = 0; } WindowChanged((struct win *)0, 'w'); -- cgit v1.2.1 From 1df022599350ae3882843b772b2bc0869348b894 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 23 Feb 2010 20:35:03 -0500 Subject: Remove old code. --- src/process.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index b12eafb..add2c2a 100644 --- a/src/process.c +++ b/src/process.c @@ -51,6 +51,7 @@ #include "logfile.h" #include "layout.h" #include "viewport.h" +#include "list_generic.h" extern struct comm comms[]; extern char *rc_name; @@ -2202,7 +2203,7 @@ int key; #endif case RC_WINDOWLIST: if (!*args) - display_wlist(0, WLIST_NUM, (struct win *)0); + display_windows(0, WLIST_NUM, (struct win *)0); else if (!strcmp(*args, "string")) { if (args[1]) @@ -2244,7 +2245,7 @@ int key; break; } if (i == argc) - display_wlist(blank, flag, (struct win *)0); + display_windows(blank, flag, (struct win *)0); } break; case RC_HELP: -- cgit v1.2.1 From d1d0cc4d63eed5234f55aa0228196815f9969ae0 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Wed, 24 Feb 2010 08:46:57 -0500 Subject: Allow moving windows around from the window list. Press ',' to switch the selected window with its previous window (in the same group). Similarly, press '.' to switch with the next window. --- src/process.c | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index add2c2a..137037d 100644 --- a/src/process.c +++ b/src/process.c @@ -1,4 +1,7 @@ -/* Copyright (c) 2008, 2009 +/* Copyright (c) 2010 + * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) + * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) + * Copyright (c) 2008, 2009 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Micah Cowan (micah@cowan.name) @@ -2982,42 +2985,12 @@ int key; n += old; else if (rel < 0) n = old - n; - if (n < 0 || n >= maxwin) + if (!WindowChangeNumber(fore, n)) { - Msg(0, "Given window position is invalid."); + /* Window number could not be changed. */ queryflag = -1; return; } - p = wtab[n]; - wtab[n] = fore; - fore->w_number = n; - wtab[old] = p; - if (p) - p->w_number = old; -#ifdef MULTIUSER - /* exchange the acls for these windows. */ - AclWinSwap(old, n); -#endif -#ifdef UTMPOK - /* exchange the utmp-slots for these windows */ - if ((fore->w_slot != (slot_t) -1) && (fore->w_slot != (slot_t) 0)) - { - RemoveUtmp(fore); - SetUtmp(fore); - } - if (p && (p->w_slot != (slot_t) -1) && (p->w_slot != (slot_t) 0)) - { - /* XXX: first display wins? */ - display = fore->w_layer.l_cvlist ? fore->w_layer.l_cvlist->c_display : 0; - RemoveUtmp(p); - SetUtmp(p); - } -#endif - - WindowChanged(fore, 'n'); - WindowChanged((struct win *)0, 'w'); - WindowChanged((struct win *)0, 'W'); - WindowChanged((struct win *)0, 0); } break; case RC_SILENCE: -- cgit v1.2.1 From 261a022ce947d17471b73a71345c265df9bfe7a4 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sun, 7 Mar 2010 19:29:39 -0500 Subject: Fix build with -Werror=format-security Some distributions ( mandriva for example ) use -Werror=format-security by default when build C software to try to enhance code quality and prevent security bugs. As the policy is to correct all occurences of the error ( so there is no false positive, nor question about to fix it or not ), a patch that fix the error on gnu screen 4.0.3 have been added to the package. I have rediffed it against latest git snapshot, to be sent upstream. It mainly add "%s" where applicable. --- src/process.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index 137037d..d685501 100644 --- a/src/process.c +++ b/src/process.c @@ -691,7 +691,7 @@ int create; kp = malloc(sizeof(*kp)); if (kp == 0) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); return 0; } kp->name = SaveStr(class); @@ -2380,7 +2380,7 @@ int key; */ if ((dbuf = (char *)malloc(l)) == 0) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); break; } l = 0; @@ -2467,7 +2467,7 @@ int key; newbuf = malloc(l + 1); if (!newbuf) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); break; } user->u_plop.len = RecodeBuf((unsigned char *)oldplop.buf, oldplop.len, oldplop.enc, enc, (unsigned char *)newbuf); @@ -4501,9 +4501,9 @@ int *argl; return; } if ((pp = (char **)malloc((unsigned)(argc + 1) * sizeof(char **))) == 0) - Panic(0, strnomem); + Panic(0, "%s", strnomem); if ((lp = (int *)malloc((unsigned)(argc) * sizeof(int *))) == 0) - Panic(0, strnomem); + Panic(0, "%s", strnomem); act->nr = nr; act->args = pp; act->argl = lp; @@ -4525,7 +4525,7 @@ char **args; while (args[argc]) argc++; if ((pp = ap = (char **)malloc((unsigned)(argc + 1) * sizeof(char **))) == 0) - Panic(0, strnomem); + Panic(0, "%s", strnomem); while (argc--) *pp++ = SaveStr(*args++); *pp = 0; @@ -6074,7 +6074,7 @@ char *data; /* dummy */ { if ((pp->buf = (char *)malloc(D_user->u_plop.len)) == NULL) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); return; } bcopy(D_user->u_plop.buf, pp->buf, D_user->u_plop.len); @@ -6281,7 +6281,7 @@ char *data; #endif if (!(u->u_plop.buf = SaveStr(u->u_password))) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); D_user->u_plop.len = 0; } else -- cgit v1.2.1 From 8a6abbab0161e6df1cea2ae0033a4c7f4a47f8e9 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Sun, 14 Mar 2010 23:02:37 -0400 Subject: Add special rendition for silence'd windows. The default rendition for silence'd windows in caption/hardstatus or in the windowlist is =u (underline). Closes savannah bug #29205. --- src/process.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index d685501..cb90802 100644 --- a/src/process.c +++ b/src/process.c @@ -3894,6 +3894,10 @@ int key; { i = REND_MONITOR; } + else if (strcmp(args[0], "silence") == 0) + { + i = REND_SILENCE; + } else if (strcmp(args[0], "so") != 0) { Msg(0, "Invalid option '%s' for rendition", args[0]); @@ -5357,6 +5361,8 @@ int where; rend = renditions[REND_MONITOR]; else if ((p->w_bell == BELL_DONE || p->w_bell == BELL_FOUND) && renditions[REND_BELL] != -1) rend = renditions[REND_BELL]; + else if ((p->w_silence == SILENCE_FOUND || p->w_silence == SILENCE_DONE) && renditions[REND_SILENCE] != -1) + rend = renditions[REND_SILENCE]; } if (rend != -1) AddWinMsgRend(s, rend); -- cgit v1.2.1