summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-select-window.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-04-13 08:26:27 +0000
committernicm <nicm@openbsd.org>2020-04-13 08:26:27 +0000
commit90d7ba3861d079c6fa4f1960b5f66a00fbd31640 (patch)
tree4c99a32464efb735bdc9317da12b6fbbfb4d3ab5 /usr.bin/tmux/cmd-select-window.c
parentChange so that the appropriate hooks for windows and panes belong to (diff)
downloadwireguard-openbsd-90d7ba3861d079c6fa4f1960b5f66a00fbd31640.tar.xz
wireguard-openbsd-90d7ba3861d079c6fa4f1960b5f66a00fbd31640.zip
Make struct cmd local to cmd.c and move it out of tmux.h.
Diffstat (limited to 'usr.bin/tmux/cmd-select-window.c')
-rw-r--r--usr.bin/tmux/cmd-select-window.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-select-window.c b/usr.bin/tmux/cmd-select-window.c
index 7ad78262567..93248df5034 100644
--- a/usr.bin/tmux/cmd-select-window.c
+++ b/usr.bin/tmux/cmd-select-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-select-window.c,v 1.23 2019/04/26 11:38:51 nicm Exp $ */
+/* $OpenBSD: cmd-select-window.c,v 1.24 2020/04/13 08:26:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -84,23 +84,24 @@ const struct cmd_entry cmd_last_window_entry = {
static enum cmd_retval
cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
{
+ struct args *args = cmd_get_args(self);
struct cmd_find_state *current = &item->shared->current;
struct winlink *wl = item->target.wl;
struct session *s = item->target.s;
int next, previous, last, activity;
- next = self->entry == &cmd_next_window_entry;
- if (args_has(self->args, 'n'))
+ next = (cmd_get_entry(self) == &cmd_next_window_entry);
+ if (args_has(args, 'n'))
next = 1;
- previous = self->entry == &cmd_previous_window_entry;
- if (args_has(self->args, 'p'))
+ previous = (cmd_get_entry(self) == &cmd_previous_window_entry);
+ if (args_has(args, 'p'))
previous = 1;
- last = self->entry == &cmd_last_window_entry;
- if (args_has(self->args, 'l'))
+ last = (cmd_get_entry(self) == &cmd_last_window_entry);
+ if (args_has(args, 'l'))
last = 1;
if (next || previous || last) {
- activity = args_has(self->args, 'a');
+ activity = args_has(args, 'a');
if (next) {
if (session_next(s, activity) != 0) {
cmdq_error(item, "no next window");
@@ -125,7 +126,7 @@ cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
* If -T and select-window is invoked on same window as
* current, switch to previous window.
*/
- if (args_has(self->args, 'T') && wl == s->curw) {
+ if (args_has(args, 'T') && wl == s->curw) {
if (session_last(s) != 0) {
cmdq_error(item, "no last window");
return (-1);