=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.271 retrieving revision 1.272 diff -u -r1.271 -r1.272 --- src/usr.bin/tmux/server-client.c 2019/03/16 17:14:07 1.271 +++ src/usr.bin/tmux/server-client.c 2019/03/18 20:53:33 1.272 @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.271 2019/03/16 17:14:07 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.272 2019/03/18 20:53:33 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -411,12 +411,13 @@ { struct session *s = c->session; struct mouse_event *m = &c->tty.mouse; - struct window *w; + struct winlink *wl; struct window_pane *wp; u_int x, y, b, sx, sy, px, py; int flag; key_code key; struct timeval tv; + struct style_range *sr; enum { NOTYPE, MOVE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type; enum { NOWHERE, PANE, STATUS, STATUS_LEFT, STATUS_RIGHT, BORDER } where; @@ -503,17 +504,29 @@ /* Is this on the status line? */ m->statusat = status_at_line(c); - if (m->statusat != -1 && y == (u_int)m->statusat) { - if (x < c->status.left_size) + if (m->statusat != -1 && + y >= (u_int)m->statusat && + y < m->statusat + status_line_size(c)) + sr = status_get_range(c, x, y - m->statusat); + else + sr = NULL; + if (sr != NULL) { + switch (sr->type) { + case STYLE_RANGE_NONE: + break; + case STYLE_RANGE_LEFT: where = STATUS_LEFT; - else if (x > c->tty.sx - c->status.right_size) + break; + case STYLE_RANGE_RIGHT: where = STATUS_RIGHT; - else { - w = status_get_window_at(c, x); - if (w == NULL) - return (KEYC_UNKNOWN); - m->w = w->id; - where = STATUS; + break; + case STYLE_RANGE_WINDOW: + wl = winlink_find_by_index(&s->windows, sr->argument); + if (wl != NULL) { + m->w = wl->window->id; + where = STATUS; + } + break; } }