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-select-pane.c | |
parent | df912e3540968a2a0b266e523ecc08bb2dc0ca20 (diff) | |
download | rtmux-ede8312d59c5d08990f83f38682c26434823525b.tar.gz rtmux-ede8312d59c5d08990f83f38682c26434823525b.tar.bz2 rtmux-ede8312d59c5d08990f83f38682c26434823525b.zip |
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-select-pane.c')
-rw-r--r-- | cmd-select-pane.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cmd-select-pane.c b/cmd-select-pane.c index 0dd847d6..fce34784 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -24,8 +24,8 @@ * Select pane. */ -void cmd_select_pane_key_binding(struct cmd *, int); -int cmd_select_pane_exec(struct cmd *, struct cmd_ctx *); +void cmd_select_pane_key_binding(struct cmd *, int); +enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_select_pane_entry = { "select-pane", "selectp", @@ -63,7 +63,7 @@ cmd_select_pane_key_binding(struct cmd *self, int key) args_set(self->args, 't', ":.+"); } -int +enum cmd_retval cmd_select_pane_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; @@ -73,26 +73,26 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_ctx *ctx) if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) { wl = cmd_find_window(ctx, args_get(args, 't'), NULL); if (wl == NULL) - return (-1); + return (CMD_RETURN_ERROR); if (wl->window->last == NULL) { ctx->error(ctx, "no last pane"); - return (-1); + return (CMD_RETURN_ERROR); } window_set_active_pane(wl->window, wl->window->last); server_status_window(wl->window); server_redraw_window_borders(wl->window); - return (0); + return (CMD_RETURN_NORMAL); } if ((wl = cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp)) == NULL) - return (-1); + return (CMD_RETURN_ERROR); if (!window_pane_visible(wp)) { ctx->error(ctx, "pane not visible"); - return (-1); + return (CMD_RETURN_ERROR); } if (args_has(self->args, 'L')) @@ -105,12 +105,12 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_ctx *ctx) wp = window_pane_find_down(wp); if (wp == NULL) { ctx->error(ctx, "pane not found"); - return (-1); + return (CMD_RETURN_ERROR); } window_set_active_pane(wl->window, wp); server_status_window(wl->window); server_redraw_window_borders(wl->window); - return (0); + return (CMD_RETURN_NORMAL); } |