Hi This can be a little simpler since cmd_lookup_*id will do the check for % or @ for you. Also -t.1 is valid for a pane, it doesn't need a :.
Try this please: Index: cmd-attach-session.c =================================================================== RCS file: /cvs/src/usr.bin/tmux/cmd-attach-session.c,v retrieving revision 1.28 diff -u -p -r1.28 cmd-attach-session.c --- cmd-attach-session.c 10 Oct 2013 12:28:08 -0000 1.28 +++ cmd-attach-session.c 10 Dec 2013 15:39:24 -0000 @@ -47,6 +47,9 @@ cmd_attach_session(struct cmd_q *cmdq, c { struct session *s; struct client *c; + struct winlink *wl = NULL; + struct window *w = NULL; + struct window_pane *wp = NULL; const char *update; char *cause; u_int i; @@ -59,11 +62,30 @@ cmd_attach_session(struct cmd_q *cmdq, c return (CMD_RETURN_ERROR); } - if ((s = cmd_find_session(cmdq, tflag, 1)) == NULL) - return (CMD_RETURN_ERROR); + if (tflag == NULL) { + if ((s = cmd_find_session(cmdq, tflag, 1)) == NULL) + return (CMD_RETURN_ERROR); + } else if (tflag[strcspn(tflag, ":.")] != '\0') { + if ((wl = cmd_find_pane(cmdq, tflag, &s, &wp)) == NULL) + return (CMD_RETURN_ERROR); + } else { + if ((s = cmd_find_session(cmdq, tflag, 1)) == NULL) + return (CMD_RETURN_ERROR); + w = cmd_lookup_windowid(tflag); + if (w == NULL && (wp = cmd_lookup_paneid(tflag)) != NULL) + w = wp->window; + if (w != NULL) + wl = winlink_find_by_window(&s->windows, w); + } if (cmdq->client == NULL) return (CMD_RETURN_NORMAL); + + if (wl != NULL) { + if (wp != NULL) + window_set_active_pane(wp->window, wp); + session_set_current(s, wl); + } if (cmdq->client->session != NULL) { if (dflag) { Index: cmd.c =================================================================== RCS file: /cvs/src/usr.bin/tmux/cmd.c,v retrieving revision 1.89 diff -u -p -r1.89 cmd.c --- cmd.c 10 Oct 2013 12:29:35 -0000 1.89 +++ cmd.c 10 Dec 2013 15:25:48 -0000 @@ -126,9 +126,7 @@ struct session *cmd_lookup_session(const struct session *cmd_lookup_session_id(const char *); struct winlink *cmd_lookup_window(struct session *, const char *, int *); int cmd_lookup_index(struct session *, const char *, int *); -struct window_pane *cmd_lookup_paneid(const char *); struct winlink *cmd_lookup_winlink_windowid(struct session *, const char *); -struct window *cmd_lookup_windowid(const char *); struct session *cmd_window_session(struct cmd_q *, struct window *, struct winlink **); struct winlink *cmd_find_window_offset(const char *, struct session *, int *); Index: tmux.h =================================================================== RCS file: /cvs/src/usr.bin/tmux/tmux.h,v retrieving revision 1.432 diff -u -p -r1.432 tmux.h --- tmux.h 23 Oct 2013 11:31:03 -0000 1.432 +++ tmux.h 10 Dec 2013 15:26:06 -0000 @@ -1739,6 +1739,8 @@ int cmd_find_index(struct cmd_q *, con struct winlink *cmd_find_pane(struct cmd_q *, const char *, struct session **, struct window_pane **); char *cmd_template_replace(const char *, const char *, int); +struct window *cmd_lookup_windowid(const char *); +struct window_pane *cmd_lookup_paneid(const char *); extern const struct cmd_entry *cmd_table[]; extern const struct cmd_entry cmd_attach_session_entry; extern const struct cmd_entry cmd_bind_key_entry; ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users