From 0ff335961eec019d776f19bd8c26cce7cde0effa Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 17 Jun 2015 16:50:28 +0000 Subject: Move the shuffle code from new-window -a into a function and add a -a flag for move-window too. From Thomas Adam. --- cmd-move-window.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cmd-move-window.c') diff --git a/cmd-move-window.c b/cmd-move-window.c index e765b625..b15df4f6 100644 --- a/cmd-move-window.c +++ b/cmd-move-window.c @@ -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); -- cgit