aboutsummaryrefslogtreecommitdiff
path: root/cmd-select-window.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-07-11 19:37:32 +0000
committerTiago Cunha <tcunha@gmx.com>2012-07-11 19:37:32 +0000
commit1f5e6e35d5046693f0ef5ec76535f517757b7122 (patch)
treee53808c90f3a53279554f8580d2b96df606baec3 /cmd-select-window.c
parenta432fcd30617610b46d65f49b7513bf5da5694de (diff)
downloadrtmux-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-select-window.c')
-rw-r--r--cmd-select-window.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/cmd-select-window.c b/cmd-select-window.c
index ab071093..5d87e59a 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -26,8 +26,8 @@
* Select window by index.
*/
-void cmd_select_window_key_binding(struct cmd *, int);
-int cmd_select_window_exec(struct cmd *, struct cmd_ctx *);
+void cmd_select_window_key_binding(struct cmd *, int);
+enum cmd_retval cmd_select_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_select_window_entry = {
"select-window", "selectw",
@@ -83,7 +83,7 @@ cmd_select_window_key_binding(struct cmd *self, int key)
args_set(self->args, 'a', NULL);
}
-int
+enum cmd_retval
cmd_select_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
@@ -104,23 +104,23 @@ cmd_select_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if (next || previous || last) {
s = cmd_find_session(ctx, args_get(args, 't'), 0);
if (s == NULL)
- return (-1);
+ return (CMD_RETURN_ERROR);
activity = args_has(self->args, 'a');
if (next) {
if (session_next(s, activity) != 0) {
ctx->error(ctx, "no next window");
- return (-1);
+ return (CMD_RETURN_ERROR);
}
} else if (previous) {
if (session_previous(s, activity) != 0) {
ctx->error(ctx, "no previous window");
- return (-1);
+ return (CMD_RETURN_ERROR);
}
} else {
if (session_last(s) != 0) {
ctx->error(ctx, "no last window");
- return (-1);
+ return (CMD_RETURN_ERROR);
}
}
@@ -128,12 +128,12 @@ cmd_select_window_exec(struct cmd *self, struct cmd_ctx *ctx)
} else {
wl = cmd_find_window(ctx, args_get(args, 't'), &s);
if (wl == NULL)
- return (-1);
+ return (CMD_RETURN_ERROR);
if (session_select(s, wl->idx) == 0)
server_redraw_session(s);
}
recalculate_sizes();
- return (0);
+ return (CMD_RETURN_NORMAL);
}