diff options
author | Tiago Cunha <tcunha@gmx.com> | 2012-07-11 19:37:32 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2012-07-11 19:37:32 +0000 |
commit | 1f5e6e35d5046693f0ef5ec76535f517757b7122 (patch) | |
tree | e53808c90f3a53279554f8580d2b96df606baec3 /cmd-join-pane.c | |
parent | a432fcd30617610b46d65f49b7513bf5da5694de (diff) | |
download | rtmux-1f5e6e35d5046693f0ef5ec76535f517757b7122.tar.gz rtmux-1f5e6e35d5046693f0ef5ec76535f517757b7122.tar.bz2 rtmux-1f5e6e35d5046693f0ef5ec76535f517757b7122.zip |
Sync OpenBSD patchset 1151:
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-join-pane.c')
-rw-r--r-- | cmd-join-pane.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/cmd-join-pane.c b/cmd-join-pane.c index f223d72b..a2e7a2dc 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -28,10 +28,10 @@ * Join or move a pane into another (like split/swap/kill). */ -void cmd_join_pane_key_binding(struct cmd *, int); -int cmd_join_pane_exec(struct cmd *, struct cmd_ctx *); +void cmd_join_pane_key_binding(struct cmd *, int); +enum cmd_retval cmd_join_pane_exec(struct cmd *, struct cmd_ctx *); -int join_pane(struct cmd *, struct cmd_ctx *, int); +enum cmd_retval join_pane(struct cmd *, struct cmd_ctx *, int); const struct cmd_entry cmd_join_pane_entry = { "join-pane", "joinp", @@ -67,13 +67,13 @@ cmd_join_pane_key_binding(struct cmd *self, int key) } } -int +enum cmd_retval cmd_join_pane_exec(struct cmd *self, struct cmd_ctx *ctx) { return (join_pane(self, ctx, self->entry == &cmd_join_pane_entry)); } -int +enum cmd_retval join_pane(struct cmd *self, struct cmd_ctx *ctx, int not_same_window) { struct args *args = self->args; @@ -88,22 +88,22 @@ join_pane(struct cmd *self, struct cmd_ctx *ctx, int not_same_window) dst_wl = cmd_find_pane(ctx, args_get(args, 't'), &dst_s, &dst_wp); if (dst_wl == NULL) - return (-1); + return (CMD_RETURN_ERROR); dst_w = dst_wl->window; dst_idx = dst_wl->idx; 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 (not_same_window && src_w == dst_w) { ctx->error(ctx, "can't join a pane to its own window"); - return (-1); + return (CMD_RETURN_ERROR); } if (!not_same_window && src_wp == dst_wp) { ctx->error(ctx, "source and target panes must be different"); - return (-1); + return (CMD_RETURN_ERROR); } type = LAYOUT_TOPBOTTOM; @@ -116,14 +116,14 @@ join_pane(struct cmd *self, struct cmd_ctx *ctx, int not_same_window) if (cause != NULL) { ctx->error(ctx, "size %s", cause); free(cause); - return (-1); + return (CMD_RETURN_ERROR); } } else if (args_has(args, 'p')) { percentage = args_strtonum(args, 'p', 0, 100, &cause); if (cause != NULL) { ctx->error(ctx, "percentage %s", cause); free(cause); - return (-1); + return (CMD_RETURN_ERROR); } if (type == LAYOUT_TOPBOTTOM) size = (dst_wp->sy * percentage) / 100; @@ -133,7 +133,7 @@ join_pane(struct cmd *self, struct cmd_ctx *ctx, int not_same_window) lc = layout_split_pane(dst_wp, type, size, args_has(args, 'b')); if (lc == NULL) { ctx->error(ctx, "create pane failed: pane too small"); - return (-1); + return (CMD_RETURN_ERROR); } layout_close_pane(src_wp); @@ -167,5 +167,5 @@ join_pane(struct cmd *self, struct cmd_ctx *ctx, int not_same_window) server_status_session(dst_s); notify_window_layout_changed(dst_w); - return (0); + return (CMD_RETURN_NORMAL); } |