mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-19 09:52:06 +02:00
Add a new option, mouse-resize-pane. When on, panes may be resized by
dragging their borders. From hsim at gmx.li.
This commit is contained in:
@@ -89,6 +89,9 @@ server_client_create(int fd)
|
||||
c->prompt_buffer = NULL;
|
||||
c->prompt_index = 0;
|
||||
|
||||
c->last_mouse.b = MOUSE_UP;
|
||||
c->last_mouse.x = c->last_mouse.y = -1;
|
||||
|
||||
evtimer_set(&c->repeat_timer, server_client_repeat_timer, c);
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
@@ -344,6 +347,9 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (options_get_number(oo, "mouse-resize-pane"))
|
||||
layout_resize_pane_mouse(c, mouse);
|
||||
memcpy(&c->last_mouse, mouse, sizeof c->last_mouse);
|
||||
window_pane_mouse(wp, c->session, mouse);
|
||||
return;
|
||||
}
|
||||
@@ -475,15 +481,25 @@ server_client_reset_state(struct client *c)
|
||||
else
|
||||
tty_cursor(&c->tty, wp->xoff + s->cx, wp->yoff + s->cy);
|
||||
|
||||
/*
|
||||
* Resizing panes with the mouse requires at least button mode to give
|
||||
* a smooth appearance.
|
||||
*/
|
||||
mode = s->mode;
|
||||
if ((c->last_mouse.b & MOUSE_RESIZE_PANE) &&
|
||||
!(mode & (MODE_MOUSE_BUTTON|MODE_MOUSE_ANY)))
|
||||
mode |= MODE_MOUSE_BUTTON;
|
||||
|
||||
/*
|
||||
* Any mode will do for mouse-select-pane, but set standard mode if
|
||||
* none.
|
||||
*/
|
||||
mode = s->mode;
|
||||
if ((mode & ALL_MOUSE_MODES) == 0) {
|
||||
if (TAILQ_NEXT(TAILQ_FIRST(&w->panes), entry) != NULL &&
|
||||
options_get_number(oo, "mouse-select-pane"))
|
||||
mode |= MODE_MOUSE_STANDARD;
|
||||
else if (options_get_number(oo, "mouse-resize-pane"))
|
||||
mode |= MODE_MOUSE_STANDARD;
|
||||
else if (options_get_number(oo, "mouse-select-window"))
|
||||
mode |= MODE_MOUSE_STANDARD;
|
||||
else if (options_get_number(wo, "mode-mouse"))
|
||||
|
Reference in New Issue
Block a user