summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-find.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2018-05-03 16:57:00 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2018-05-03 16:57:00 +0000
commitd3dd36290fb31a76b59eac14dfd4c800152ed7f4 (patch)
tree2ec64ec58932f95cc463c0cf22e2816ab1c6bb59 /usr.bin/tmux/cmd-find.c
parent5e3c6ea9fc1fb4598e6ab656e9431ad2b557b8ea (diff)
Use window target if specified and exists even when looking for an
index, fixes neww -a with -t as well.
Diffstat (limited to 'usr.bin/tmux/cmd-find.c')
-rw-r--r--usr.bin/tmux/cmd-find.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/tmux/cmd-find.c b/usr.bin/tmux/cmd-find.c
index 5dfd00d25f7..fe90a822adf 100644
--- a/usr.bin/tmux/cmd-find.c
+++ b/usr.bin/tmux/cmd-find.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-find.c,v 1.61 2018/04/18 14:35:37 nicm Exp $ */
+/* $OpenBSD: cmd-find.c,v 1.62 2018/05/03 16:56:59 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -437,15 +437,15 @@ cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window)
if (window[0] != '+' && window[0] != '-') {
idx = strtonum(window, 0, INT_MAX, &errstr);
if (errstr == NULL) {
- if (fs->flags & CMD_FIND_WINDOW_INDEX) {
- fs->idx = idx;
- return (0);
- }
fs->wl = winlink_find_by_index(&fs->s->windows, idx);
if (fs->wl != NULL) {
fs->w = fs->wl->window;
return (0);
}
+ if (fs->flags & CMD_FIND_WINDOW_INDEX) {
+ fs->idx = idx;
+ return (0);
+ }
}
}
@@ -1182,7 +1182,8 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
/* This will fill in session, winlink and window. */
if (cmd_find_get_window(fs, window, window_only) != 0)
goto no_window;
- fs->wp = fs->wl->window->active;
+ if (fs->wl != NULL) /* can be NULL if index only */
+ fs->wp = fs->wl->window->active;
goto found;
}