summaryrefslogtreecommitdiffstats
path: root/cmd-break-pane.c
diff options
context:
space:
mode:
authornicm <nicm>2017-04-22 10:22:39 +0000
committernicm <nicm>2017-04-22 10:22:39 +0000
commitee45a8a149e1a3c8fe7c232a9e32f3a007e21bee (patch)
tree21cc9cafd10d55cd7cd92ec616d08ac59adc4a0a /cmd-break-pane.c
parent2c0f826c360fc5a8f0e125759b596eb28441ba65 (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 'cmd-break-pane.c')
-rw-r--r--cmd-break-pane.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index a2648418..b92c5077 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -35,10 +35,11 @@ const struct cmd_entry cmd_break_pane_entry = {
.alias = "breakp",
.args = { "dPF:n:s:t:", 0, 0 },
- .usage = "[-dP] [-F format] [-n window-name] [-s src-pane] [-t dst-window]",
+ .usage = "[-dP] [-F format] [-n window-name] [-s src-pane] "
+ "[-t dst-window]",
- .sflag = CMD_PANE,
- .tflag = CMD_WINDOW_INDEX,
+ .source = { 's', CMD_FIND_PANE, 0 },
+ .target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX },
.flags = 0,
.exec = cmd_break_pane_exec
@@ -49,14 +50,14 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct cmd_find_state *current = &item->shared->current;
- struct client *c = item->state.c;
- struct winlink *wl = item->state.sflag.wl;
- struct session *src_s = item->state.sflag.s;
- struct session *dst_s = item->state.tflag.s;
- struct window_pane *wp = item->state.sflag.wp;
+ struct client *c = cmd_find_client(item, NULL, 1);
+ struct winlink *wl = item->source.wl;
+ struct session *src_s = item->source.s;
+ struct session *dst_s = item->target.s;
+ struct window_pane *wp = item->source.wp;
struct window *w = wl->window;
char *name, *cause;
- int idx = item->state.tflag.idx;
+ int idx = item->target.idx;
const char *template;
char *cp;