mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-08 01:04:06 +01:00
Layout fixes
This commit is contained in:
parent
a104b160b2
commit
66e4f554c3
@ -722,6 +722,8 @@ server_client_loop(void)
|
||||
#ifdef TMATE
|
||||
if (w->flags & WINDOW_REDRAW)
|
||||
tmate_should_sync_layout = 1;
|
||||
if (w->tmate_last_sync_active_pane != w->active)
|
||||
tmate_should_sync_layout = 1;
|
||||
#endif
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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_pane *wp;
|
||||
@ -118,13 +118,16 @@ static struct window_pane *find_window_pane(struct session *s, unsigned int pane
|
||||
wp = w->active;
|
||||
if (!wp)
|
||||
goto slow_path;
|
||||
if (wp->id == pane_id)
|
||||
if (pane_id == -1 || (int)wp->id == pane_id)
|
||||
return wp;
|
||||
|
||||
slow_path:
|
||||
if (pane_id == -1)
|
||||
return NULL;
|
||||
|
||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
|
||||
if (wp->id == pane_id)
|
||||
if ((int)wp->id == pane_id)
|
||||
return wp;
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +48,16 @@ void tmate_sync_layout(void)
|
||||
struct window_pane *wp;
|
||||
int num_panes = 0;
|
||||
int num_windows = 0;
|
||||
int active_pane_id = -1;
|
||||
int active_pane_id;
|
||||
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.
|
||||
* Especially when the HTML5 client will come along.
|
||||
@ -83,6 +90,9 @@ void tmate_sync_layout(void)
|
||||
if (!w)
|
||||
continue;
|
||||
|
||||
w->tmate_last_sync_active_pane = NULL;
|
||||
active_pane_id = -1;
|
||||
|
||||
if (active_window_idx == -1)
|
||||
active_window_idx = wl->idx;
|
||||
|
||||
@ -103,8 +113,11 @@ void tmate_sync_layout(void)
|
||||
pack(int, wp->xoff);
|
||||
pack(int, wp->yoff);
|
||||
|
||||
if (wp == w->active)
|
||||
if (wp == w->active) {
|
||||
w->tmate_last_sync_active_pane = wp;
|
||||
active_pane_id = wp->id;
|
||||
}
|
||||
|
||||
}
|
||||
pack(int, active_pane_id);
|
||||
}
|
||||
|
3
tmux.h
3
tmux.h
@ -915,6 +915,9 @@ struct window {
|
||||
|
||||
struct timeval activity_time;
|
||||
|
||||
#ifdef TMATE
|
||||
struct window_pane *tmate_last_sync_active_pane;
|
||||
#endif
|
||||
struct window_pane *active;
|
||||
struct window_pane *last;
|
||||
struct window_panes panes;
|
||||
|
Loading…
Reference in New Issue
Block a user