diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-04-21 22:42:28 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-04-21 22:42:28 +0000 |
commit | dcb242201fc0cc97d7bdf074f40c4804daafeb4e (patch) | |
tree | 356b66709eda04c00438df08c1fda8870d97d577 | |
parent | 9a934d84f1ab3dd5678e5a4402b937ff00fdf119 (diff) |
Look up indexes as number before name, makes more sense if windows are
named starting with numbers. From Thomas Adam.
-rw-r--r-- | usr.bin/tmux/cmd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index 8fe774cdedd..a09c3d8dd69 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.99 2015/04/19 21:34:21 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.100 2015/04/21 22:42:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); } |