=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd.c,v retrieving revision 1.35 retrieving revision 1.36 diff -c -r1.35 -r1.36 *** src/usr.bin/tmux/cmd.c 2009/12/03 22:50:10 1.35 --- src/usr.bin/tmux/cmd.c 2009/12/08 07:49:31 1.36 *************** *** 1,4 **** ! /* $OpenBSD: cmd.c,v 1.35 2009/12/03 22:50:10 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd.c,v 1.36 2009/12/08 07:49:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 856,867 **** cmd_find_pane(struct cmd_ctx *ctx, const char *arg, struct session **sp, struct window_pane **wpp) { ! struct session *s; ! struct winlink *wl; ! const char *period; ! char *winptr, *paneptr; ! const char *errstr; ! u_int idx; /* Get the current session. */ if ((s = cmd_current_session(ctx)) == NULL) { --- 856,867 ---- cmd_find_pane(struct cmd_ctx *ctx, const char *arg, struct session **sp, struct window_pane **wpp) { ! struct session *s; ! struct winlink *wl; ! struct layout_cell *lc; ! const char *period, *errstr; ! char *winptr, *paneptr; ! u_int idx; /* Get the current session. */ if ((s = cmd_current_session(ctx)) == NULL) { *************** *** 895,914 **** *wpp = wl->window->active; else { idx = strtonum(paneptr, 0, INT_MAX, &errstr); ! if (errstr != NULL) { ! ctx->error(ctx, "pane %s: %s", errstr, paneptr); ! goto error; ! } *wpp = window_pane_at_index(wl->window, idx); ! if (*wpp == NULL) { ! ctx->error(ctx, "no such pane: %u", idx); ! goto error; ! } } xfree(winptr); return (wl); no_period: /* Try as a pane number alone. */ idx = strtonum(arg, 0, INT_MAX, &errstr); --- 895,921 ---- *wpp = wl->window->active; else { idx = strtonum(paneptr, 0, INT_MAX, &errstr); ! if (errstr != NULL) ! goto lookup_string; *wpp = window_pane_at_index(wl->window, idx); ! if (*wpp == NULL) ! goto lookup_string; } xfree(winptr); return (wl); + lookup_string: + /* Try pane string description. */ + if ((lc = layout_find_string(s->curw->window, paneptr)) == NULL) { + ctx->error(ctx, "can't find pane: %s", paneptr); + goto error; + } + *wpp = lc->wp; + + xfree(winptr); + return (s->curw); + no_period: /* Try as a pane number alone. */ idx = strtonum(arg, 0, INT_MAX, &errstr); *************** *** 922,927 **** --- 929,940 ---- return (s->curw); lookup_window: + /* Try pane string description. */ + if ((lc = layout_find_string(s->curw->window, arg)) != NULL) { + *wpp = lc->wp; + return (s->curw); + } + /* Try as a window and use the active pane. */ if ((wl = cmd_find_window(ctx, arg, sp)) != NULL) *wpp = wl->window->active;