summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-swap-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-04-22 10:22:40 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-04-22 10:22:40 +0000
commit3b5031a1e691e18e1bbe892b262d81db17887237 (patch)
tree280122dc6016981c484998db1ba10afbfdadb998 /usr.bin/tmux/cmd-swap-window.c
parent61be04363b84fafcbfe17c4d58547b1ca814e2c7 (diff)
Get rid of the extra layer of flags and cmd_prepare() and just store the
CMD_FIND_* flags in the cmd_entry and call it for the command. Commands with special requirements call it themselves and update the target for hooks to use.
Diffstat (limited to 'usr.bin/tmux/cmd-swap-window.c')
-rw-r--r--usr.bin/tmux/cmd-swap-window.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-swap-window.c b/usr.bin/tmux/cmd-swap-window.c
index 97b19908b42..d7694c71fce 100644
--- a/usr.bin/tmux/cmd-swap-window.c
+++ b/usr.bin/tmux/cmd-swap-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-swap-window.c,v 1.22 2017/02/09 15:04:53 nicm Exp $ */
+/* $OpenBSD: cmd-swap-window.c,v 1.23 2017/04/22 10:22:39 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -35,8 +35,8 @@ const struct cmd_entry cmd_swap_window_entry = {
.args = { "ds:t:", 0, 0 },
.usage = "[-d] " CMD_SRCDST_WINDOW_USAGE,
- .sflag = CMD_WINDOW_MARKED,
- .tflag = CMD_WINDOW,
+ .source = { 's', CMD_FIND_WINDOW, CMD_FIND_DEFAULT_MARKED },
+ .target = { 't', CMD_FIND_WINDOW, 0 },
.flags = 0,
.exec = cmd_swap_window_exec
@@ -50,12 +50,12 @@ cmd_swap_window_exec(struct cmd *self, struct cmdq_item *item)
struct winlink *wl_src, *wl_dst;
struct window *w_src, *w_dst;
- wl_src = item->state.sflag.wl;
- src = item->state.sflag.s;
+ wl_src = item->source.wl;
+ src = item->source.s;
sg_src = session_group_contains(src);
- wl_dst = item->state.tflag.wl;
- dst = item->state.tflag.s;
+ wl_dst = item->target.wl;
+ dst = item->target.s;
sg_dst = session_group_contains(dst);
if (src != dst && sg_src != NULL && sg_dst != NULL &&