=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-resize-pane.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- src/usr.bin/tmux/cmd-resize-pane.c 2017/05/11 07:24:42 1.31 +++ src/usr.bin/tmux/cmd-resize-pane.c 2018/06/08 20:54:22 1.32 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-resize-pane.c,v 1.31 2017/05/11 07:24:42 nicm Exp $ */ +/* $OpenBSD: cmd-resize-pane.c,v 1.32 2018/06/08 20:54:22 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -129,14 +129,16 @@ cmd_resize_pane_mouse_update(struct client *c, struct mouse_event *m) { struct winlink *wl; - struct window_pane *loop, *wp_x, *wp_y; - u_int y, ly, x, lx, sx, sy, ex, ey; + struct window *w; + u_int y, ly, x, lx; + struct layout_cell *lc; wl = cmd_mouse_window(m, NULL); if (wl == NULL) { c->tty.mouse_drag_update = NULL; return; } + w = wl->window; y = m->y; x = m->x; if (m->statusat == 0 && y > 0) @@ -149,37 +151,16 @@ else if (m->statusat > 0 && ly >= (u_int)m->statusat) ly = m->statusat - 1; - wp_x = wp_y = NULL; - TAILQ_FOREACH(loop, &wl->window->panes, entry) { - if (!window_pane_visible(loop)) - continue; + lc = layout_search_by_border(w->layout_root, lx, ly); + if (lc == NULL) + return; - sx = loop->xoff; - if (sx != 0) - sx--; - ex = loop->xoff + loop->sx; - - sy = loop->yoff; - if (sy != 0) - sy--; - ey = loop->yoff + loop->sy; - - if ((lx == sx || lx == ex) && - (ly >= sy && ly <= ey) && - (wp_x == NULL || loop->sy > wp_x->sy)) - wp_x = loop; - if ((ly == sy || ly == ey) && - (lx >= sx && lx <= ex) && - (wp_y == NULL || loop->sx > wp_y->sx)) - wp_y = loop; - } - if (wp_x == NULL && wp_y == NULL) { - c->tty.mouse_drag_update = NULL; + if (y != ly && lc->parent->type == LAYOUT_TOPBOTTOM) + layout_resize_layout(w, lc, LAYOUT_TOPBOTTOM, y - ly, 0); + else if (x != lx && lc->parent->type == LAYOUT_LEFTRIGHT) + layout_resize_layout(w, lc, LAYOUT_LEFTRIGHT, x - lx, 0); + else return; - } - if (wp_x != NULL) - layout_resize_pane(wp_x, LAYOUT_LEFTRIGHT, x - lx, 0); - if (wp_y != NULL) - layout_resize_pane(wp_y, LAYOUT_TOPBOTTOM, y - ly, 0); - server_redraw_window(wl->window); + + server_redraw_window(w); }