=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-select-window.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- src/usr.bin/tmux/cmd-select-window.c 2012/07/11 07:10:15 1.8 +++ src/usr.bin/tmux/cmd-select-window.c 2012/12/24 12:34:32 1.9 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-window.c,v 1.8 2012/07/11 07:10:15 nicm Exp $ */ +/* $OpenBSD: cmd-select-window.c,v 1.9 2012/12/24 12:34:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -31,8 +31,8 @@ const struct cmd_entry cmd_select_window_entry = { "select-window", "selectw", - "lnpt:", 0, 0, - "[-lnp] " CMD_TARGET_WINDOW_USAGE, + "lnpTt:", 0, 0, + "[-lnpT] " CMD_TARGET_WINDOW_USAGE, 0, cmd_select_window_key_binding, NULL, @@ -130,7 +130,17 @@ if (wl == NULL) return (CMD_RETURN_ERROR); - if (session_select(s, wl->idx) == 0) + /* + * If -T and select-window is invoked on same window as + * current, switch to previous window. + */ + if (args_has(self->args, 'T') && wl == s->curw) { + if (session_last(s) != 0) { + ctx->error(ctx, "no last window"); + return (-1); + } + server_redraw_session(s); + } else if (session_select(s, wl->idx) == 0) server_redraw_session(s); } recalculate_sizes();