From: nicm Date: Tue, 21 Apr 2015 22:42:27 +0000 (+0000) Subject: Look up indexes as number before name, makes more sense if windows are X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=863b4a85b52149a3f1ecfb4f754b1a502310152d;p=openbsd Look up indexes as number before name, makes more sense if windows are named starting with numbers. From Thomas Adam. --- 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 @@ -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); }