That looks even better. 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)
> cmdq_error(item, "not a control client");
> return (CMD_RETURN_ERROR);
> }
> - if (tty_set_size(&c->tty, w, h))
> + if (tty_set_size(&c->tty, w, h)) {
> + c->flags |= CLIENT_SIZECHANGED;
> recalculate_sizes();
> + }
> } else if (args_has(args, 'S')) {
> c->flags |= CLIENT_STATUSFORCE;
> 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)
> TAILQ_FOREACH(c, &clients, entry) {
> if (c->flags & CLIENT_SUSPENDED)
> continue;
> + if ((c->flags &
> (CLIENT_CONTROL|CLIENT_SIZECHANGED)) ==
> + CLIENT_CONTROL)
> + continue;
> if (c->session == s) {
> if (c->tty.sx < ssx)
> 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 {
> #define CLIENT_STATUSFORCE 0x80000
> #define CLIENT_DOUBLECLICK 0x100000
> #define CLIENT_TRIPLECLICK 0x200000
> +#define CLIENT_SIZECHANGED 0x400000
> int flags;
> struct key_table *keytable;
>
>
>
>
> On Tue, May 09, 2017 at 11:20:53PM -0700, George Nachman wrote:
> > When a control mode client attaches, the client size is unknown. A
> control
> > mode client's tty is initialized to 80x24. When attaching,
> > recalculate_sizes gets called, which changes pane layouts.
> > Unlike regular clients, control mode clients should always set the
> client
> > size explicitly with refresh-client -C, but they don't get a chance
> to do
> > so early enough.
> > To avoid corrupting the existing layouts when detaching and
> reattaching,
> > this patch sets a control mode client's tty size when attaching for
> the
> > first time based on the existing window sizes in the session.
> > One issue: Behavior in aggressive-resize isn't great. I'm not sure how
> > much it matters in practice. iTerm2 refuses to attach when
> > aggressive-resize is enabled.
> >
> > --
> > 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 email to [email protected].
> > 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,
> > struct winlink *wl;
> > struct window_pane *wp;
> > char *cause;
> > + int of = c->flags;
> > + u_int sx, sy;
> >
> > if (RB_EMPTY(&sessions)) {
> > cmdq_error(item, "no sessions");
> > @@ -153,6 +155,16 @@ cmd_attach_session(struct cmdq_item *item, const
> char *tflag, int dflag,
> > notify_client("client-attached", c);
> > c->flags |= CLIENT_ATTACHED;
> > }
> > + if (!(of & CLIENT_ATTACHED) && (c->flags & CLIENT_CONTROL)) {
> > + sx = sy = 0;
> > + RB_FOREACH(wl, winlinks, &s->windows) {
> > + if (wl->window->sx > sx) sx = wl->window->sx;
> > + if (wl->window->sy > sy) sy = wl->window->sy;
> > + }
> > + if (sx > 0 && sy > 0) {
> > + tty_set_size(&c->tty, sx, sy);
> > + }
> > + }
> > recalculate_sizes();
> > alerts_check_session(s);
> > 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.