summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-02-16 11:27:49 -0500
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-02-16 11:27:49 -0500
commit7399960d86d8561aebd68d5fe331b44594decbd0 (patch)
tree633b18fd2d768d0f15597f6f56f6d8d9af4c6e91
parent929be520ad026011ac98420f4a56fa93dff06899 (diff)
downloadscreen-7399960d86d8561aebd68d5fe331b44594decbd0.tar.gz
Allow querying 'select'.
Using this, it will be possible to detect if a particular window exists or not.
-rw-r--r--src/comm.c2
-rw-r--r--src/process.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/comm.c b/src/comm.c
index 4843e10..ba9806b 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -286,7 +286,7 @@ struct comm comms[RC_LAST + 1] =
#ifdef COPY_PASTE
{ "scrollback", NEED_FORE|ARGS_1 },
#endif
- { "select", ARGS_01 },
+ { "select", CAN_QUERY|ARGS_01 },
{ "sessionname", ARGS_01 },
{ "setenv", ARGS_012 },
{ "setsid", ARGS_1 },
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: