diff options
author | 2015-06-17 16:50:28 +0000 | |
---|---|---|
committer | 2015-06-17 16:50:28 +0000 | |
commit | fe1fa7a5f1c9bfa1ed283eca424edd7ed1ebccee (patch) | |
tree | f5fcd50ceb140a1106cc31e76b04e5abb074e0f2 /usr.bin/tmux/cmd-move-window.c | |
parent | Use an explicit job state instead of avoid closing our side of the (diff) | |
download | wireguard-openbsd-fe1fa7a5f1c9bfa1ed283eca424edd7ed1ebccee.tar.xz wireguard-openbsd-fe1fa7a5f1c9bfa1ed283eca424edd7ed1ebccee.zip |
Move the shuffle code from new-window -a into a function and add a -a
flag for move-window too. From Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/cmd-move-window.c')
-rw-r--r-- | usr.bin/tmux/cmd-move-window.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-move-window.c b/usr.bin/tmux/cmd-move-window.c index dd80a64838e..ecb08574ba0 100644 --- a/usr.bin/tmux/cmd-move-window.c +++ b/usr.bin/tmux/cmd-move-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-move-window.c,v 1.19 2015/04/21 21:24:49 nicm Exp $ */ +/* $OpenBSD: cmd-move-window.c,v 1.20 2015/06/17 16:50:28 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -30,7 +30,7 @@ enum cmd_retval cmd_move_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_move_window_entry = { "move-window", "movew", - "dkrs:t:", 0, 0, + "adkrs:t:", 0, 0, "[-dkr] " CMD_SRCDST_WINDOW_USAGE, 0, cmd_move_window_exec @@ -38,7 +38,7 @@ const struct cmd_entry cmd_move_window_entry = { const struct cmd_entry cmd_link_window_entry = { "link-window", "linkw", - "dks:t:", 0, 0, + "adks:t:", 0, 0, "[-dk] " CMD_SRCDST_WINDOW_USAGE, 0, cmd_move_window_exec @@ -72,6 +72,15 @@ cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq) kflag = args_has(self->args, 'k'); dflag = args_has(self->args, 'd'); sflag = args_has(self->args, 's'); + + if (args_has(self->args, 'a')) { + s = cmd_find_session(cmdq, args_get(args, 't'), 0); + if (s == NULL) + return (CMD_RETURN_ERROR); + if ((idx = winlink_shuffle_up(s, s->curw)) == -1) + return (CMD_RETURN_ERROR); + } + if (server_link_window(src, wl, dst, idx, kflag, !dflag, &cause) != 0) { cmdq_error(cmdq, "can't link window: %s", cause); |