Yes... the bottom border belongs to the pane above it, but we would be
better to pick the biggest pane I suppose. Try this please:


Index: cmd-resize-pane.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/cmd-resize-pane.c,v
retrieving revision 1.30
diff -u -p -r1.30 cmd-resize-pane.c
--- cmd-resize-pane.c   22 Apr 2017 10:22:39 -0000      1.30
+++ cmd-resize-pane.c   10 May 2017 17:58:21 -0000
@@ -129,9 +129,8 @@ static void
 cmd_resize_pane_mouse_update(struct client *c, struct mouse_event *m)
 {
        struct winlink          *wl;
-       struct window_pane      *wp;
-       int                      found;
-       u_int                    y, ly;
+       struct window_pane      *loop, *wp_x, *wp_y;
+       u_int                    y, ly, x, lx, sx, sy, ex, ey;
 
        wl = cmd_mouse_window(m, NULL);
        if (wl == NULL) {
@@ -139,37 +138,48 @@ cmd_resize_pane_mouse_update(struct clie
                return;
        }
 
-       y = m->y;
+       y = m->y; x = m->x;
        if (m->statusat == 0 && y > 0)
                y--;
        else if (m->statusat > 0 && y >= (u_int)m->statusat)
                y = m->statusat - 1;
-       ly = m->ly;
+       ly = m->ly; lx = m->lx;
        if (m->statusat == 0 && ly > 0)
                ly--;
        else if (m->statusat > 0 && ly >= (u_int)m->statusat)
                ly = m->statusat - 1;
 
-       found = 0;
-       TAILQ_FOREACH(wp, &wl->window->panes, entry) {
-               if (!window_pane_visible(wp))
+       wp_x = wp_y = NULL;
+       TAILQ_FOREACH(loop, &wl->window->panes, entry) {
+               if (!window_pane_visible(loop))
                        continue;
 
-               if (wp->xoff + wp->sx == m->lx &&
-                   wp->yoff <= 1 + ly &&
-                   wp->yoff + wp->sy >= ly) {
-                       layout_resize_pane(wp, LAYOUT_LEFTRIGHT, m->x - m->lx, 
0);
-                       found = 1;
-               }
-               if (wp->yoff + wp->sy == ly &&
-                   wp->xoff <= 1 + m->lx &&
-                   wp->xoff + wp->sx >= m->lx) {
-                       layout_resize_pane(wp, LAYOUT_TOPBOTTOM, y - ly, 0);
-                       found = 1;
-               }
+               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 (found)
-               server_redraw_window(wl->window);
-       else
+       if (wp_x == NULL && wp_y == NULL) {
                c->tty.mouse_drag_update = NULL;
+               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);
 }




On Wed, May 10, 2017 at 05:57:01PM +0200, Thomas Sattler wrote:
> Hi there ...
> 
> there is a bug when resizing panes using the mouse.
> It exists since 2.3 and is still in 2.5rc.
> 
> Start tmux (without a config file) like this:
> 
> $ ./tmux new-session \; \
>  set-option mouse on \; \
>  split-window -h \; \
>  split-window -v \; \
>  split-window -v -f
> 
> You'll see a layout like this:
> 
> +--------------------+--------------------+
> |$                   |$        1          |
> |                    |                    |
> |          0         +--------------------+
> |                    |$        2          |
> |                    |                    |
> +--------------------+--------------------+
> |$                                        |
> |                                         |
> |                    3                    |
> |                                         |
> |                                         |
> +-----------------------------------------+
> 
> Now try to resize by dragging the border
> between the panes 2 and 3:
> 
> Dragging the border between 2 and 3 at least
> two lines up (or down) will first move the
> border between 1 and 2 up (or down) one line
> and then put the pane 2 (or 3) into copy mode.
> 
> I can trigger it running tmux inside xterm on
> Gentoo Linux with TERM=xterm or xterm-256color.
> 
> In case you cannot reproduce it, I'll happily
> send the generated tmux-server-*.log .
> 
> Thomas
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send an email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to