summaryrefslogtreecommitdiffstats
path: root/cmd-move-window.c
diff options
context:
space:
mode:
authornicm <nicm>2015-06-17 16:50:28 +0000
committernicm <nicm>2015-06-17 16:50:28 +0000
commit0ff335961eec019d776f19bd8c26cce7cde0effa (patch)
treec45e265253049e3e04755c09eac03006fa3f5f55 /cmd-move-window.c
parent021cdbe1c0111951a1f63b09b41c9e3db3793db5 (diff)
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 'cmd-move-window.c')
-rw-r--r--cmd-move-window.c13
1 files changed, 11 insertions, 2 deletions
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);