mirror of
https://github.com/tmate-io/tmate.git
synced 2025-06-19 17:17:53 +02:00
Layout fixes
This commit is contained in:
parent
a104b160b2
commit
66e4f554c3
@ -722,6 +722,8 @@ server_client_loop(void)
|
|||||||
#ifdef TMATE
|
#ifdef TMATE
|
||||||
if (w->flags & WINDOW_REDRAW)
|
if (w->flags & WINDOW_REDRAW)
|
||||||
tmate_should_sync_layout = 1;
|
tmate_should_sync_layout = 1;
|
||||||
|
if (w->tmate_last_sync_active_pane != w->active)
|
||||||
|
tmate_should_sync_layout = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
w->flags &= ~WINDOW_REDRAW;
|
w->flags &= ~WINDOW_REDRAW;
|
||||||
|
@ -105,7 +105,7 @@ static void tmate_client_pane_key(struct tmate_unpacker *uk)
|
|||||||
window_pane_key(wp, NULL, s, key, NULL);
|
window_pane_key(wp, NULL, s, key, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct window_pane *find_window_pane(struct session *s, unsigned int pane_id)
|
static struct window_pane *find_window_pane(struct session *s, int pane_id)
|
||||||
{
|
{
|
||||||
struct window *w;
|
struct window *w;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
@ -118,13 +118,16 @@ static struct window_pane *find_window_pane(struct session *s, unsigned int pane
|
|||||||
wp = w->active;
|
wp = w->active;
|
||||||
if (!wp)
|
if (!wp)
|
||||||
goto slow_path;
|
goto slow_path;
|
||||||
if (wp->id == pane_id)
|
if (pane_id == -1 || (int)wp->id == pane_id)
|
||||||
return wp;
|
return wp;
|
||||||
|
|
||||||
slow_path:
|
slow_path:
|
||||||
|
if (pane_id == -1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||||
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
|
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
|
||||||
if (wp->id == pane_id)
|
if ((int)wp->id == pane_id)
|
||||||
return wp;
|
return wp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,16 @@ void tmate_sync_layout(void)
|
|||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
int num_panes = 0;
|
int num_panes = 0;
|
||||||
int num_windows = 0;
|
int num_windows = 0;
|
||||||
int active_pane_id = -1;
|
int active_pane_id;
|
||||||
int active_window_idx = -1;
|
int active_window_idx = -1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO this can get a little heavy.
|
||||||
|
* We are shipping the full layout whenever a window name changes,
|
||||||
|
* that is, at every shell command.
|
||||||
|
* Might be better to do something incremental.
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We only allow one session, it makes our lives easier.
|
* We only allow one session, it makes our lives easier.
|
||||||
* Especially when the HTML5 client will come along.
|
* Especially when the HTML5 client will come along.
|
||||||
@ -83,6 +90,9 @@ void tmate_sync_layout(void)
|
|||||||
if (!w)
|
if (!w)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
w->tmate_last_sync_active_pane = NULL;
|
||||||
|
active_pane_id = -1;
|
||||||
|
|
||||||
if (active_window_idx == -1)
|
if (active_window_idx == -1)
|
||||||
active_window_idx = wl->idx;
|
active_window_idx = wl->idx;
|
||||||
|
|
||||||
@ -103,8 +113,11 @@ void tmate_sync_layout(void)
|
|||||||
pack(int, wp->xoff);
|
pack(int, wp->xoff);
|
||||||
pack(int, wp->yoff);
|
pack(int, wp->yoff);
|
||||||
|
|
||||||
if (wp == w->active)
|
if (wp == w->active) {
|
||||||
|
w->tmate_last_sync_active_pane = wp;
|
||||||
active_pane_id = wp->id;
|
active_pane_id = wp->id;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
pack(int, active_pane_id);
|
pack(int, active_pane_id);
|
||||||
}
|
}
|
||||||
|
3
tmux.h
3
tmux.h
@ -915,6 +915,9 @@ struct window {
|
|||||||
|
|
||||||
struct timeval activity_time;
|
struct timeval activity_time;
|
||||||
|
|
||||||
|
#ifdef TMATE
|
||||||
|
struct window_pane *tmate_last_sync_active_pane;
|
||||||
|
#endif
|
||||||
struct window_pane *active;
|
struct window_pane *active;
|
||||||
struct window_pane *last;
|
struct window_pane *last;
|
||||||
struct window_panes panes;
|
struct window_panes panes;
|
||||||
|
4
window.c
4
window.c
@ -296,6 +296,10 @@ window_create1(u_int sx, u_int sy)
|
|||||||
TAILQ_INIT(&w->panes);
|
TAILQ_INIT(&w->panes);
|
||||||
w->active = NULL;
|
w->active = NULL;
|
||||||
|
|
||||||
|
#ifdef TMATE
|
||||||
|
w->tmate_last_sync_active_pane = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
w->lastlayout = -1;
|
w->lastlayout = -1;
|
||||||
w->layout_root = NULL;
|
w->layout_root = NULL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user