diff options
Diffstat (limited to 'cmd-previous-window.c')
-rw-r--r-- | cmd-previous-window.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/cmd-previous-window.c b/cmd-previous-window.c index d6d0ad21..7d70d3ca 100644 --- a/cmd-previous-window.c +++ b/cmd-previous-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-previous-window.c,v 1.21 2009-11-14 17:56:39 tcunha Exp $ */ +/* $Id: cmd-previous-window.c,v 1.22 2011-01-07 14:45:34 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -24,44 +24,39 @@ * Move to previous window. */ -void cmd_previous_window_init(struct cmd *, int); +void cmd_previous_window_key_binding(struct cmd *, int); int cmd_previous_window_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_previous_window_entry = { "previous-window", "prev", + "at:", 0, 0, "[-a] " CMD_TARGET_SESSION_USAGE, - 0, "a", - cmd_previous_window_init, - cmd_target_parse, - cmd_previous_window_exec, - cmd_target_free, - cmd_target_print + 0, + cmd_previous_window_key_binding, + NULL, + cmd_previous_window_exec }; void -cmd_previous_window_init(struct cmd *self, int key) +cmd_previous_window_key_binding(struct cmd *self, int key) { - struct cmd_target_data *data; - - cmd_target_init(self, key); - data = self->data; - + self->args = args_create(0); if (key == ('p' | KEYC_ESCAPE)) - cmd_set_flag(&data->chflags, 'a'); + args_set(self->args, 'a', NULL); } int cmd_previous_window_exec(struct cmd *self, struct cmd_ctx *ctx) { - struct cmd_target_data *data = self->data; - struct session *s; - int activity; + struct args *args = self->args; + struct session *s; + int activity; - if ((s = cmd_find_session(ctx, data->target)) == NULL) + if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL) return (-1); activity = 0; - if (cmd_check_flag(data->chflags, 'a')) + if (args_has(self->args, 'a')) activity = 1; if (session_previous(s, activity) == 0) |