=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd.c,v retrieving revision 1.146 retrieving revision 1.147 diff -u -r1.146 -r1.147 --- src/usr.bin/tmux/cmd.c 2019/05/03 18:42:40 1.146 +++ src/usr.bin/tmux/cmd.c 2019/05/08 18:05:03 1.147 @@ -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 @@ -510,17 +510,22 @@ { 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. */