diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2012-07-11 07:10:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2012-07-11 07:10:15 +0000 |
commit | ede8312d59c5d08990f83f38682c26434823525b (patch) | |
tree | bdf66e80ca1d71548a554804f4ab6656a828a821 /cmd-swap-pane.c | |
parent | df912e3540968a2a0b266e523ecc08bb2dc0ca20 (diff) |
Make command exec functions return an enum rather than -1/0/1 values and
add a new value to mean "leave client running but don't attach" to fix
problems with using some commands in a command sequence. Most of the
work by Thomas Adam, problem reported by "jspenguin" on SF bug 3535531.
Diffstat (limited to 'cmd-swap-pane.c')
-rw-r--r-- | cmd-swap-pane.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index aa133faf..6d9fcfeb 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -26,8 +26,8 @@ * Swap two panes. */ -void cmd_swap_pane_key_binding(struct cmd *, int); -int cmd_swap_pane_exec(struct cmd *, struct cmd_ctx *); +void cmd_swap_pane_key_binding(struct cmd *, int); +enum cmd_retval cmd_swap_pane_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_swap_pane_entry = { "swap-pane", "swapp", @@ -49,7 +49,7 @@ cmd_swap_pane_key_binding(struct cmd *self, int key) args_set(self->args, 'D', NULL); } -int +enum cmd_retval cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; @@ -61,7 +61,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) dst_wl = cmd_find_pane(ctx, args_get(args, 't'), NULL, &dst_wp); if (dst_wl == NULL) - return (-1); + return (CMD_RETURN_ERROR); dst_w = dst_wl->window; if (!args_has(args, 's')) { @@ -75,16 +75,16 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) if (src_wp == NULL) src_wp = TAILQ_LAST(&dst_w->panes, window_panes); } else - return (0); + return (CMD_RETURN_NORMAL); } else { src_wl = cmd_find_pane(ctx, args_get(args, 's'), NULL, &src_wp); if (src_wl == NULL) - return (-1); + return (CMD_RETURN_ERROR); src_w = src_wl->window; } if (src_wp == dst_wp) - return (0); + return (CMD_RETURN_NORMAL); tmp_wp = TAILQ_PREV(dst_wp, window_panes, entry); TAILQ_REMOVE(&dst_w->panes, dst_wp, entry); @@ -138,5 +138,5 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) server_redraw_window(src_w); server_redraw_window(dst_w); - return (0); + return (CMD_RETURN_NORMAL); } |