diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-07-11 07:10:16 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-07-11 07:10:16 +0000 |
commit | 156a018a1068e24b3e4fe3c282d9f7c23218f83d (patch) | |
tree | d810dc12ac531587df2b51a4c4a39e577eb803d0 /usr.bin/tmux/cmd-choose-tree.c | |
parent | 5fbceaea80d4bc47fc3ffb9f184c6b478e3b16d1 (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 'usr.bin/tmux/cmd-choose-tree.c')
-rw-r--r-- | usr.bin/tmux/cmd-choose-tree.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-choose-tree.c b/usr.bin/tmux/cmd-choose-tree.c index 86f0f748298..6d76ef266c4 100644 --- a/usr.bin/tmux/cmd-choose-tree.c +++ b/usr.bin/tmux/cmd-choose-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-choose-tree.c,v 1.3 2012/07/10 11:53:01 nicm Exp $ */ +/* $OpenBSD: cmd-choose-tree.c,v 1.4 2012/07/11 07:10:15 nicm Exp $ */ /* * Copyright (c) 2012 Thomas Adam <thomas@xteddy.org> @@ -70,7 +70,7 @@ const struct cmd_entry cmd_choose_window_entry = { cmd_choose_tree_exec }; -int +enum cmd_retval cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; @@ -89,17 +89,17 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx) if (ctx->curclient == NULL) { ctx->error(ctx, "must be run interactively"); - return (-1); + return (CMD_RETURN_ERROR); } s = ctx->curclient->session; tty = &ctx->curclient->tty; if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) - return (-1); + return (CMD_RETURN_ERROR); if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) - return (0); + return (CMD_RETURN_NORMAL); /* Sort out which command this is. */ wflag = sflag = 0; @@ -221,7 +221,7 @@ windows_only: window_choose_ready(wl->window->active, cur_win, cmd_choose_tree_callback, cmd_choose_tree_free); - return (0); + return (CMD_RETURN_NORMAL); } void @@ -248,4 +248,3 @@ cmd_choose_tree_free(struct window_choose_data *cdata) free(cdata); } - |