Great, applied, thanks!
On Wed, May 10, 2017 at 04:20:20PM +0000, George Nachman wrote: > A That looks even better.A Thank you! > On Tue, May 9, 2017 at 11:57 PM Nicholas Marriott > <[email protected]> wrote: > > Hi > > I think a better solution might be if control clients do not affect the > session and window size until they call refresh-client -C - so they > effectively have no size at all until then. This means control clients > that don't care about the output, perhaps if they are just looking for > certain events, can avoid changing the size at all. > > How about this? > > diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c > index 5190df89..6af3362b 100644 > --- a/cmd-refresh-client.c > +++ b/cmd-refresh-client.c > @@ -67,8 +67,10 @@ cmd_refresh_client_exec(struct cmd *self, struct > cmdq_item *item) > A A A A A A A A A A A A cmdq_error(item, "not a control > client"); > A A A A A A A A A A A A return (CMD_RETURN_ERROR); > A A A A A A A A } > -A A A A A A A A if (tty_set_size(&c->tty, w, h)) > +A A A A A A A A if (tty_set_size(&c->tty, w, h)) { > +A A A A A A A A A A A A c->flags |= CLIENT_SIZECHANGED; > A A A A A A A A A A A A recalculate_sizes(); > +A A A A A A A A } > A A A A } else if (args_has(args, 'S')) { > A A A A A A A A c->flags |= CLIENT_STATUSFORCE; > A A A A A A A A server_status_client(c); > diff --git a/resize.c b/resize.c > index ff1c9eec..4c41f769 100644 > --- a/resize.c > +++ b/resize.c > @@ -60,6 +60,9 @@ recalculate_sizes(void) > A A A A A A A A TAILQ_FOREACH(c, &clients, entry) { > A A A A A A A A A A A A if (c->flags & CLIENT_SUSPENDED) > A A A A A A A A A A A A A A A A continue; > +A A A A A A A A A A A A if ((c->flags & > (CLIENT_CONTROL|CLIENT_SIZECHANGED)) == > +A A A A A A A A A A A A A A CLIENT_CONTROL) > +A A A A A A A A A A A A A A A A continue; > A A A A A A A A A A A A if (c->session == s) { > A A A A A A A A A A A A A A A A if (c->tty.sx < ssx) > A A A A A A A A A A A A A A A A A A A A ssx = > c->tty.sx; > diff --git a/tmux.h b/tmux.h > index e8ad55ff..3edb5457 100644 > --- a/tmux.h > +++ b/tmux.h > @@ -1349,6 +1349,7 @@ struct client { > A #define CLIENT_STATUSFORCE 0x80000 > A #define CLIENT_DOUBLECLICK 0x100000 > A #define CLIENT_TRIPLECLICK 0x200000 > +#define CLIENT_SIZECHANGED 0x400000 > A A A A intA A A A A A A flags; > A A A A struct key_table *keytable; > > On Tue, May 09, 2017 at 11:20:53PM -0700, George Nachman wrote: > >A A When a control mode client attaches, the client size is unknown. > A control > >A A mode client's tty is initialized to 80x24. When attaching, > >A A recalculate_sizes gets called, which changes pane layouts. > >A A Unlike regular clients, control mode clients should always set > the client > >A A size explicitly with refresh-client -C, but they don't get a > chance to do > >A A so early enough. > >A A To avoid corrupting the existing layouts when detaching and > reattaching, > >A A this patch sets a control mode client's tty size when attaching > for the > >A A first time based on the existing window sizes in the session. > >A A One issue: Behavior in aggressive-resize isn't great. I'm not > sure how > >A A much it matters in practice. iTerm2 refuses to attach when > >A A aggressive-resize is enabled. > > > >A A -- > >A A You received this message because you are subscribed to the > Google Groups > >A A "tmux-users" group. > >A A To unsubscribe from this group and stop receiving emails from it, > send an > >A A email to [email protected]. > >A A To post to this group, send email to [email protected]. > >A A For more options, visit https://groups.google.com/d/optout. > > > diff --git a/cmd-attach-session.c b/cmd-attach-session.c > > index 81ed4a8..4cc84c7 100644 > > --- a/cmd-attach-session.c > > +++ b/cmd-attach-session.c > > @@ -58,6 +58,8 @@ cmd_attach_session(struct cmdq_item *item, const > char *tflag, int dflag, > >A A A A struct winlinkA A A A A *wl; > >A A A A struct window_paneA A A *wp; > >A A A A charA A A A A A A A A A *cause; > > +A A A intA A A A A A A A A A A of = c->flags; > > +A A A u_intA A A A A A A A A A sx, sy; > > > >A A A A if (RB_EMPTY(&sessions)) { > >A A A A A A A A cmdq_error(item, "no sessions"); > > @@ -153,6 +155,16 @@ cmd_attach_session(struct cmdq_item *item, const > char *tflag, int dflag, > >A A A A A A A A notify_client("client-attached", c); > >A A A A A A A A c->flags |= CLIENT_ATTACHED; > >A A A A } > > +A A A if (!(of & CLIENT_ATTACHED) && (c->flags & CLIENT_CONTROL)) { > > +A A A A A A A sx = sy = 0; > > +A A A A A A A RB_FOREACH(wl, winlinks, &s->windows) { > > +A A A A A A A A A A A if (wl->window->sx > sx) sx = > wl->window->sx; > > +A A A A A A A A A A A if (wl->window->sy > sy) sy = > wl->window->sy; > > +A A A A A A A } > > +A A A A A A A if (sx > 0 && sy > 0) { > > +A A A A A A A A A A A tty_set_size(&c->tty, sx, sy); > > +A A A A A A A } > > +A A A } > >A A A A recalculate_sizes(); > >A A A A alerts_check_session(s); > >A A A A server_update_socket(); -- 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.
