diff options
Diffstat (limited to 'cmd-previous-window.c')
-rw-r--r-- | cmd-previous-window.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/cmd-previous-window.c b/cmd-previous-window.c index d0423998..dd7560ce 100644 --- a/cmd-previous-window.c +++ b/cmd-previous-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-previous-window.c,v 1.6 2007-12-06 09:46:22 nicm Exp $ */ +/* $Id: cmd-previous-window.c,v 1.7 2008-06-02 18:08:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -30,20 +30,26 @@ void cmd_previous_window_exec(void *, struct cmd_ctx *); const struct cmd_entry cmd_previous_window_entry = { - "previous-window", "prev", "", - CMD_NOCLIENT, - NULL, + "previous-window", "prev", + CMD_SESSIONONLY_USAGE, + 0, + cmd_sessiononly_parse, cmd_previous_window_exec, - NULL, - NULL, - NULL + cmd_sessiononly_send, + cmd_sessiononly_recv, + cmd_sessiononly_free }; void -cmd_previous_window_exec(unused void *ptr, struct cmd_ctx *ctx) +cmd_previous_window_exec(void *ptr, struct cmd_ctx *ctx) { - if (session_previous(ctx->session) == 0) - server_redraw_session(ctx->session); + struct session *s; + + if ((s = cmd_sessiononly_get(ptr, ctx)) == NULL) + return; + + if (session_previous(s) == 0) + server_redraw_session(s); else ctx->error(ctx, "no previous window"); |