mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Change how we resolve which pane is dragging when there are multiple
options - choose the largest pane, which is more likely to be the one the user wants to resize. Prompted by a report from Thomas Sattler.
This commit is contained in:
parent
8ab2753521
commit
c54a5b3690
@ -129,9 +129,8 @@ static void
|
|||||||
cmd_resize_pane_mouse_update(struct client *c, struct mouse_event *m)
|
cmd_resize_pane_mouse_update(struct client *c, struct mouse_event *m)
|
||||||
{
|
{
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
struct window_pane *wp;
|
struct window_pane *loop, *wp_x, *wp_y;
|
||||||
int found;
|
u_int y, ly, x, lx, sx, sy, ex, ey;
|
||||||
u_int y, ly;
|
|
||||||
|
|
||||||
wl = cmd_mouse_window(m, NULL);
|
wl = cmd_mouse_window(m, NULL);
|
||||||
if (wl == NULL) {
|
if (wl == NULL) {
|
||||||
@ -139,37 +138,48 @@ cmd_resize_pane_mouse_update(struct client *c, struct mouse_event *m)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = m->y;
|
y = m->y; x = m->x;
|
||||||
if (m->statusat == 0 && y > 0)
|
if (m->statusat == 0 && y > 0)
|
||||||
y--;
|
y--;
|
||||||
else if (m->statusat > 0 && y >= (u_int)m->statusat)
|
else if (m->statusat > 0 && y >= (u_int)m->statusat)
|
||||||
y = m->statusat - 1;
|
y = m->statusat - 1;
|
||||||
ly = m->ly;
|
ly = m->ly; lx = m->lx;
|
||||||
if (m->statusat == 0 && ly > 0)
|
if (m->statusat == 0 && ly > 0)
|
||||||
ly--;
|
ly--;
|
||||||
else if (m->statusat > 0 && ly >= (u_int)m->statusat)
|
else if (m->statusat > 0 && ly >= (u_int)m->statusat)
|
||||||
ly = m->statusat - 1;
|
ly = m->statusat - 1;
|
||||||
|
|
||||||
found = 0;
|
wp_x = wp_y = NULL;
|
||||||
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
|
TAILQ_FOREACH(loop, &wl->window->panes, entry) {
|
||||||
if (!window_pane_visible(wp))
|
if (!window_pane_visible(loop))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (wp->xoff + wp->sx == m->lx &&
|
sx = loop->xoff;
|
||||||
wp->yoff <= 1 + ly &&
|
if (sx != 0)
|
||||||
wp->yoff + wp->sy >= ly) {
|
sx--;
|
||||||
layout_resize_pane(wp, LAYOUT_LEFTRIGHT, m->x - m->lx, 0);
|
ex = loop->xoff + loop->sx;
|
||||||
found = 1;
|
|
||||||
}
|
sy = loop->yoff;
|
||||||
if (wp->yoff + wp->sy == ly &&
|
if (sy != 0)
|
||||||
wp->xoff <= 1 + m->lx &&
|
sy--;
|
||||||
wp->xoff + wp->sx >= m->lx) {
|
ey = loop->yoff + loop->sy;
|
||||||
layout_resize_pane(wp, LAYOUT_TOPBOTTOM, y - ly, 0);
|
|
||||||
found = 1;
|
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)
|
if (wp_x == NULL && wp_y == NULL) {
|
||||||
server_redraw_window(wl->window);
|
|
||||||
else
|
|
||||||
c->tty.mouse_drag_update = 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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user