diff options
author | 2012-07-11 07:10:15 +0000 | |
---|---|---|
committer | 2012-07-11 07:10:15 +0000 | |
commit | a224d0d3ac3348ad8dc1a5ad50b3236b714355cb (patch) | |
tree | df2f2d708c70b79c7062f0952940023e476a9709 /usr.bin/tmux/cmd-select-pane.c | |
parent | Separate total block counter (reported to user) from 8-bit block counter (diff) | |
download | wireguard-openbsd-a224d0d3ac3348ad8dc1a5ad50b3236b714355cb.tar.xz wireguard-openbsd-a224d0d3ac3348ad8dc1a5ad50b3236b714355cb.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 'usr.bin/tmux/cmd-select-pane.c')
-rw-r--r-- | usr.bin/tmux/cmd-select-pane.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-select-pane.c b/usr.bin/tmux/cmd-select-pane.c index 0f46842bccd..e6b06e12f78 100644 --- a/usr.bin/tmux/cmd-select-pane.c +++ b/usr.bin/tmux/cmd-select-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-pane.c,v 1.13 2011/01/31 20:54:42 nicm Exp $ */ +/* $OpenBSD: cmd-select-pane.c,v 1.14 2012/07/11 07:10:15 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); } |