summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-05-08 18:05:03 +0000
committernicm <nicm@openbsd.org>2019-05-08 18:05:03 +0000
commit9b9cde726e20c52af922ff071b0caaa941a3a3f2 (patch)
treebbbae77c3352cbd717fa7b8660db0bb8066fa7f6 /usr.bin/tmux/cmd.c
parentxr to sysupgrade (diff)
downloadwireguard-openbsd-9b9cde726e20c52af922ff071b0caaa941a3a3f2.tar.xz
wireguard-openbsd-9b9cde726e20c52af922ff071b0caaa941a3a3f2.zip
Adjust how mouse targets are found so they always have a session, window
and pane.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r--usr.bin/tmux/cmd.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 54f1c86a87a..abb2e9a2917 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.146 2019/05/03 18:42:40 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.147 2019/05/08 18:05:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -510,17 +510,22 @@ cmd_mouse_window(struct mouse_event *m, struct session **sp)
{
struct session *s;
struct window *w;
+ struct winlink *wl;
- if (!m->valid || m->s == -1 || m->w == -1)
+ if (!m->valid)
return (NULL);
- if ((s = session_find_by_id(m->s)) == NULL)
+ if (m->s == -1 || (s = session_find_by_id(m->s)) == NULL)
return (NULL);
- if ((w = window_find_by_id(m->w)) == NULL)
- return (NULL);
-
+ if (m->w == -1)
+ wl = s->curw;
+ else {
+ if ((w = window_find_by_id(m->w)) == NULL)
+ return (NULL);
+ wl = winlink_find_by_window(&s->windows, w);
+ }
if (sp != NULL)
*sp = s;
- return (winlink_find_by_window(&s->windows, w));
+ return (wl);
}
/* Get current mouse pane if any. */