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-layout.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-layout.c')
-rw-r--r-- | usr.bin/tmux/cmd-select-layout.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.bin/tmux/cmd-select-layout.c b/usr.bin/tmux/cmd-select-layout.c index fe3ed6849c5..86c95e0dedf 100644 --- a/usr.bin/tmux/cmd-select-layout.c +++ b/usr.bin/tmux/cmd-select-layout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-layout.c,v 1.15 2012/04/01 13:27:18 nicm Exp $ */ +/* $OpenBSD: cmd-select-layout.c,v 1.16 2012/07/11 07:10:15 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -24,8 +24,8 @@ * Switch window to selected layout. */ -void cmd_select_layout_key_binding(struct cmd *, int); -int cmd_select_layout_exec(struct cmd *, struct cmd_ctx *); +void cmd_select_layout_key_binding(struct cmd *, int); +enum cmd_retval cmd_select_layout_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_select_layout_entry = { "select-layout", "selectl", @@ -90,7 +90,7 @@ cmd_select_layout_key_binding(struct cmd *self, int key) } } -int +enum cmd_retval cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; @@ -100,7 +100,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) int next, previous, layout; if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) - return (-1); + return (CMD_RETURN_ERROR); w = wl->window; next = self->entry == &cmd_next_layout_entry; @@ -114,13 +114,13 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(self->args, 'U')) { if ((layoutname = layout_list_redo(w)) == NULL) { ctx->info(ctx, "no more layout history"); - return (-1); + return (CMD_RETURN_ERROR); } goto set_layout; } else if (args_has(self->args, 'u')) { if ((layoutname = layout_list_undo(w)) == NULL) { ctx->info(ctx, "no more layout history"); - return (-1); + return (CMD_RETURN_ERROR); } goto set_layout; } @@ -132,7 +132,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) layout = layout_set_previous(wl->window); server_redraw_window(wl->window); ctx->info(ctx, "arranging in: %s", layout_set_name(layout)); - return (0); + return (CMD_RETURN_NORMAL); } if (args->argc == 0) @@ -143,19 +143,19 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) layout = layout_set_select(wl->window, layout); server_redraw_window(wl->window); ctx->info(ctx, "arranging in: %s", layout_set_name(layout)); - return (0); + return (CMD_RETURN_NORMAL); } if (args->argc == 0) - return (0); + return (CMD_RETURN_NORMAL); layoutname = args->argv[0]; set_layout: if (layout_parse(wl->window, layoutname) == -1) { ctx->error(ctx, "can't set layout: %s", layoutname); - return (-1); + return (CMD_RETURN_ERROR); } server_redraw_window(wl->window); ctx->info(ctx, "arranging in: %s", layoutname); - return (0); + return (CMD_RETURN_NORMAL); } |