summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authornicm <nicm>2015-04-21 22:42:27 +0000
committernicm <nicm>2015-04-21 22:42:27 +0000
commit3909aff06aa6de748ae057cab1e723eec2387edd (patch)
tree6524459e91c9606c07a83111dd627a0f9a3006e0 /cmd.c
parent69f292a90e2fb9d48a77a9753127da13554715de (diff)
Look up indexes as number before name, makes more sense if windows are
named starting with numbers. From Thomas Adam.
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd.c b/cmd.c
index dd1a0a7b..991e079b 100644
--- a/cmd.c
+++ b/cmd.c
@@ -781,15 +781,15 @@ cmd_lookup_index(struct session *s, const char *name, int *ambiguous)
const char *errstr;
u_int idx;
+ idx = strtonum(name, 0, INT_MAX, &errstr);
+ if (errstr == NULL)
+ return (idx);
+
if ((wl = cmd_lookup_window(s, name, ambiguous)) != NULL)
return (wl->idx);
if (*ambiguous)
return (-1);
- idx = strtonum(name, 0, INT_MAX, &errstr);
- if (errstr == NULL)
- return (idx);
-
return (-1);
}