I'm not getting the bleed through, but the resize causes some problems with
rendering the prompt, it plops part of my fairly long prompt on top of
where i should be typing when i zoom

http://dl.dropbox.com/u/113468811/Screenshots/nafczt3h0xb_.png


On Fri, Feb 22, 2013 at 9:29 AM, Nicholas Marriott <
nicholas.marri...@gmail.com> wrote:

> Try this instead please which should fix that:
>
> diff --git a/cmd-break-pane.c b/cmd-break-pane.c
> index a4350fe..4f329e5 100644
> --- a/cmd-break-pane.c
> +++ b/cmd-break-pane.c
> @@ -63,6 +63,8 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx
> *ctx)
>         }
>
>         w = wl->window;
> +       server_unzoom_window(w);
> +
>         TAILQ_REMOVE(&w->panes, wp, entry);
>         if (wp == w->active) {
>                 w->active = w->last;
> diff --git a/cmd-join-pane.c b/cmd-join-pane.c
> index a2e7a2d..41b532c 100644
> --- a/cmd-join-pane.c
> +++ b/cmd-join-pane.c
> @@ -91,11 +91,13 @@ join_pane(struct cmd *self, struct cmd_ctx *ctx, int
> not_same_window)
>                 return (CMD_RETURN_ERROR);
>         dst_w = dst_wl->window;
>         dst_idx = dst_wl->idx;
> +       server_unzoom_window(dst_w);
>
>         src_wl = cmd_find_pane(ctx, args_get(args, 's'), NULL, &src_wp);
>         if (src_wl == NULL)
>                 return (CMD_RETURN_ERROR);
>         src_w = src_wl->window;
> +       server_unzoom_window(src_w);
>
>         if (not_same_window && src_w == dst_w) {
>                 ctx->error(ctx, "can't join a pane to its own window");
> diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c
> index 4f7af2e..f0a17ad 100644
> --- a/cmd-kill-pane.c
> +++ b/cmd-kill-pane.c
> @@ -47,6 +47,7 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
>
>         if ((wl = cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp)) ==
> NULL)
>                 return (CMD_RETURN_ERROR);
> +       server_unzoom_window(wl->window);
>
>         if (window_count_panes(wl->window) == 1) {
>                 /* Only one pane, kill the window. */
> diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
> index 328e1b4..b056b8f 100644
> --- a/cmd-resize-pane.c
> +++ b/cmd-resize-pane.c
> @@ -31,8 +31,8 @@ enum cmd_retval        cmd_resize_pane_exec(struct cmd
> *, struct cmd_ctx *);
>
>  const struct cmd_entry cmd_resize_pane_entry = {
>         "resize-pane", "resizep",
> -       "DLRt:Ux:y:", 0, 1,
> -       "[-DLRU] [-x width] [-y height] " CMD_TARGET_PANE_USAGE "
> [adjustment]",
> +       "DLRt:Ux:y:Z", 0, 1,
> +       "[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE "
> [adjustment]",
>         0,
>         cmd_resize_pane_key_binding,
>         NULL,
> @@ -75,6 +75,10 @@ cmd_resize_pane_key_binding(struct cmd *self, int key)
>                 self->args = args_create(1, "5");
>                 args_set(self->args, 'R', NULL);
>                 break;
> +       case 'z':
> +               self->args = args_create(0);
> +               args_set(self->args, 'Z', NULL);
> +               break;
>         default:
>                 self->args = args_create(0);
>                 break;
> @@ -86,6 +90,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_ctx
> *ctx)
>  {
>         struct args             *args = self->args;
>         struct winlink          *wl;
> +       struct window           *w;
>         const char              *errstr;
>         char                    *cause;
>         struct window_pane      *wp;
> @@ -94,6 +99,18 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_ctx
> *ctx)
>
>         if ((wl = cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp)) ==
> NULL)
>                 return (CMD_RETURN_ERROR);
> +       w = wl->window;
> +
> +       if (args_has(args, 'Z')) {
> +               if (TAILQ_EMPTY(&w->saved_panes))
> +                       window_zoom(wp);
> +               else
> +                       window_unzoom(w);
> +               server_redraw_window(w);
> +               server_status_window(w);
> +               return (CMD_RETURN_NORMAL);
> +       }
> +       server_unzoom_window(w);
>
>         if (args->argc == 0)
>                 adjust = 1;
> diff --git a/cmd-select-layout.c b/cmd-select-layout.c
> index b2423e9..7e7e35e 100644
> --- a/cmd-select-layout.c
> +++ b/cmd-select-layout.c
> @@ -92,6 +92,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx
> *ctx)
>
>         if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
>                 return (CMD_RETURN_ERROR);
> +       server_unzoom_window(wl->window);
>
>         next = self->entry == &cmd_next_layout_entry;
>         if (args_has(self->args, 'n'))
> diff --git a/cmd-select-pane.c b/cmd-select-pane.c
> index 8ebae5f..71882e4 100644
> --- a/cmd-select-pane.c
> +++ b/cmd-select-pane.c
> @@ -94,6 +94,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_ctx
> *ctx)
>                 ctx->error(ctx, "pane not visible");
>                 return (CMD_RETURN_ERROR);
>         }
> +       server_unzoom_window(wp->window);
>
>         if (args_has(self->args, 'L'))
>                 wp = window_pane_find_left(wp);
> diff --git a/cmd-split-window.c b/cmd-split-window.c
> index cac8095..a21ff77 100644
> --- a/cmd-split-window.c
> +++ b/cmd-split-window.c
> @@ -72,6 +72,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx
> *ctx)
>         if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) ==
> NULL)
>                 return (CMD_RETURN_ERROR);
>         w = wl->window;
> +       server_unzoom_window(w);
>
>         environ_init(&env);
>         environ_copy(&global_environ, &env);
> diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c
> index 42fe2fc..cc9e7df 100644
> --- a/cmd-swap-pane.c
> +++ b/cmd-swap-pane.c
> @@ -63,6 +63,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
>         if (dst_wl == NULL)
>                 return (CMD_RETURN_ERROR);
>         dst_w = dst_wl->window;
> +       server_unzoom_window(dst_w);
>
>         if (!args_has(args, 's')) {
>                 src_w = dst_w;
> @@ -82,6 +83,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
>                         return (CMD_RETURN_ERROR);
>                 src_w = src_wl->window;
>         }
> +       server_unzoom_window(src_w);
>
>         if (src_wp == dst_wp)
>                 return (CMD_RETURN_NORMAL);
> diff --git a/key-bindings.c b/key-bindings.c
> index 9e5a729..bf9ff31 100644
> --- a/key-bindings.c
> +++ b/key-bindings.c
> @@ -150,6 +150,7 @@ key_bindings_init(void)
>                 { 't',                    0, &cmd_clock_mode_entry },
>                 { 'w',                    0, &cmd_choose_window_entry },
>                 { 'x',                    0, &cmd_confirm_before_entry },
> +               { 'z',                    0, &cmd_resize_pane_entry },
>                 { '{',                    0, &cmd_swap_pane_entry },
>                 { '}',                    0, &cmd_swap_pane_entry },
>                 { '~',                    0, &cmd_show_messages_entry },
> diff --git a/server-fn.c b/server-fn.c
> index 26f93d9..f17c3b1 100644
> --- a/server-fn.c
> +++ b/server-fn.c
> @@ -377,6 +377,7 @@ server_destroy_pane(struct window_pane *wp)
>                 return;
>         }
>
> +       server_unzoom_window(w);
>         layout_close_pane(wp);
>         window_remove_pane(w, wp);
>
> @@ -588,3 +589,11 @@ server_set_stdin_callback(struct client *c, void
> (*cb)(struct client *, int,
>
>         return (0);
>  }
> +
> +void
> +server_unzoom_window(struct window *w)
> +{
> +       window_unzoom(w);
> +       server_redraw_window(w);
> +       server_status_window(w);
> +}
> diff --git a/tmux.1 b/tmux.1
> index 8731efb..2f85a35 100644
> --- a/tmux.1
> +++ b/tmux.1
> @@ -1572,7 +1572,7 @@ Rename the current window, or the window at
>  if specified, to
>  .Ar new-name .
>  .It Xo Ic resize-pane
> -.Op Fl DLRU
> +.Op Fl DLRUZ
>  .Op Fl t Ar target-pane
>  .Op Fl x Ar width
>  .Op Fl y Ar height
> @@ -1596,6 +1596,11 @@ or
>  The
>  .Ar adjustment
>  is given in lines or cells (the default is 1).
> +.Pp
> +With
> +.Fl Z ,
> +the active pane is toggled between occupying the whole of the window and
> it's
> +normal position in the layout.
>  .It Xo Ic respawn-pane
>  .Op Fl k
>  .Op Fl t Ar target-pane
> diff --git a/tmux.h b/tmux.h
> index 8c06197..4d01a72 100644
> --- a/tmux.h
> +++ b/tmux.h
> @@ -928,6 +928,7 @@ struct window_pane {
>  #define PANE_REDRAW 0x1
>  #define PANE_DROP 0x2
>  #define PANE_FOCUSED 0x4
> +#define PANE_HIDDEN 0x8
>
>         char            *cmd;
>         char            *shell;
> @@ -978,6 +979,12 @@ struct window {
>         struct window_pane *last;
>         struct window_panes panes;
>
> +       struct window_pane *saved_before;
> +       struct window_pane *saved_last;
> +       struct window_panes saved_panes;
> +       struct layout_cell *saved_layout;
> +       struct layout_cell *saved_cell;
> +
>         int              lastlayout;
>         struct layout_cell *layout_root;
>
> @@ -1910,6 +1917,7 @@ void       server_push_stdout(struct client *);
>  void    server_push_stderr(struct client *);
>  int     server_set_stdin_callback(struct client *, void (*)(struct client
> *,
>              int, void *), void *, char **);
> +void    server_unzoom_window(struct window *);
>
>  /* status.c */
>  int     status_out_cmp(struct status_out *, struct status_out *);
> @@ -2113,6 +2121,8 @@ struct window_pane *window_find_string(struct window
> *, const char *);
>  void            window_set_active_pane(struct window *, struct
> window_pane *);
>  struct window_pane *window_add_pane(struct window *, u_int);
>  void            window_resize(struct window *, u_int, u_int);
> +int             window_zoom(struct window_pane *);
> +int             window_unzoom(struct window *);
>  void            window_remove_pane(struct window *, struct window_pane *);
>  struct window_pane *window_pane_at_index(struct window *, u_int);
>  struct window_pane *window_pane_next_by_number(struct window *,
> diff --git a/window.c b/window.c
> index 77f06f8..2170b07 100644
> --- a/window.c
> +++ b/window.c
> @@ -278,6 +278,7 @@ window_create1(u_int sx, u_int sy)
>         w->name = NULL;
>         w->flags = 0;
>
> +       TAILQ_INIT(&w->saved_panes);
>         TAILQ_INIT(&w->panes);
>         w->active = NULL;
>
> @@ -333,6 +334,8 @@ window_destroy(struct window *w)
>  {
>         u_int   i;
>
> +       window_unzoom(w);
> +
>         if (window_index(w, &i) != 0)
>                 fatalx("index not found");
>         ARRAY_SET(&windows, i, NULL);
> @@ -455,6 +458,75 @@ window_find_string(struct window *w, const char *s)
>         return (window_get_active_at(w, x, y));
>  }
>
> +int
> +window_zoom(struct window_pane *wp)
> +{
> +       struct window           *w = wp->window;
> +       struct window_pane      *wp1;
> +
> +       if (!TAILQ_EMPTY(&w->saved_panes))
> +               return (-1);
> +
> +       if (!window_pane_visible(wp))
> +               return (-1);
> +       if (w->active != wp)
> +               window_set_active_pane(w, wp);
> +
> +       w->saved_before = TAILQ_NEXT(wp, entry);
> +       TAILQ_REMOVE(&w->panes, wp, entry);
> +
> +       w->saved_last = w->last;
> +       w->last = NULL;
> +
> +       memcpy(&w->saved_panes, &w->panes, sizeof w->saved_panes);
> +       TAILQ_INIT(&w->panes);
> +       TAILQ_INSERT_HEAD(&w->panes, wp, entry);
> +
> +       TAILQ_FOREACH(wp1, &w->saved_panes, entry) {
> +               wp1->flags |= PANE_HIDDEN;
> +               RB_REMOVE(window_pane_tree, &all_window_panes, wp1);
> +       }
> +
> +       w->saved_cell = wp->layout_cell;
> +       w->saved_layout = w->layout_root;
> +       layout_init(w);
> +
> +       return (0);
> +}
> +
> +int
> +window_unzoom(struct window *w)
> +{
> +       struct window_pane      *wp, *wp1;
> +
> +       if (TAILQ_EMPTY(&w->saved_panes))
> +               return (-1);
> +       wp = w->active;
> +
> +       TAILQ_FOREACH(wp1, &w->saved_panes, entry) {
> +               wp1->flags &= ~PANE_HIDDEN;
> +               RB_INSERT(window_pane_tree, &all_window_panes, wp1);
> +       }
> +
> +       TAILQ_REMOVE(&w->panes, wp, entry);
> +       memcpy(&w->panes, &w->saved_panes, sizeof w->panes);
> +       TAILQ_INIT(&w->saved_panes);
> +
> +       if (w->saved_before == NULL)
> +               TAILQ_INSERT_TAIL(&w->panes, wp, entry);
> +       else
> +               TAILQ_INSERT_BEFORE(w->saved_before, wp, entry);
> +
> +       w->last = w->saved_last;
> +
> +       layout_free(w);
> +       wp->layout_cell = w->saved_cell;
> +       w->layout_root = w->saved_layout;
> +       layout_fix_panes(w, w->sx, w->sy);
> +
> +       return (0);
> +}
> +
>  struct window_pane *
>  window_add_pane(struct window *w, u_int hlimit)
>  {
> @@ -585,6 +657,8 @@ window_printable_flags(struct session *s, struct
> winlink *wl)
>                 flags[pos++] = '*';
>         if (wl == TAILQ_FIRST(&s->lastw))
>                 flags[pos++] = '-';
> +       if (!TAILQ_EMPTY(&wl->window->saved_panes))
> +               flags[pos++] = 'Z';
>         if (pos == 0)
>                 flags[pos++] = ' ';
>         flags[pos] = '\0';
> @@ -1032,6 +1106,8 @@ window_pane_visible(struct window_pane *wp)
>  {
>         struct window   *w = wp->window;
>
> +       if (wp->flags & PANE_HIDDEN)
> +               return (0);
>         if (wp->xoff >= w->sx || wp->yoff >= w->sy)
>                 return (0);
>         if (wp->xoff + wp->sx > w->sx || wp->yoff + wp->sy > w->sy)
>
>
> On Fri, Feb 22, 2013 at 09:16:36AM -0800, Aaron Jensen wrote:
> >    I may have misunderstood what this is intending to do, but I'm seeing
> pane
> >    updates even though the panes are "hidden". In other words, my zoom'd
> pane
> >    is getting overwritten when the other panes change. Is that intended?
> >
> >    On Fri, Feb 22, 2013 at 9:10 AM, Aaron Jensen <[1]
> aaronjen...@gmail.com>
> >    wrote:
> >
> >      I'm trying it today too. So far so good. Also, I was able to apply
> your
> >      patch :)
> >
> >      On Fri, Feb 22, 2013 at 8:21 AM, Nicholas Marriott
> >      <[2]nicholas.marri...@gmail.com> wrote:
> >
> >        not convinced about the way it works, need to think about it.
> also it
> >        needs testing
> >
> >        On Fri, Feb 22, 2013 at 01:10:09PM -0300, Thiago Padilha wrote:
> >        > On Fri, Feb 22, 2013 at 12:57 PM, Nicholas Marriott
> >        > <[3]nicholas.marri...@gmail.com> wrote:
> >        > > Here is the latest in case anyone wants to run with it for a
> while
> >        > > before I decide whether or not to commit it :-).
> >        > >
> >        >
> >        > What's wrong with it?
> >
> >
>  
> ------------------------------------------------------------------------------
> >        Everyone hates slow websites. So do we.
> >        Make your web apps faster with AppDynamics
> >        Download AppDynamics Lite for free today:
> >        [4]http://p.sf.net/sfu/appdyn_d2d_feb
> >        _______________________________________________
> >        tmux-users mailing list
> >        [5]tmux-users@lists.sourceforge.net
> >        [6]https://lists.sourceforge.net/lists/listinfo/tmux-users
> >
> > References
> >
> >    Visible links
> >    1. mailto:aaronjen...@gmail.com
> >    2. mailto:nicholas.marri...@gmail.com
> >    3. mailto:nicholas.marri...@gmail.com
> >    4. http://p.sf.net/sfu/appdyn_d2d_feb
> >    5. mailto:tmux-users@lists.sourceforge.net
> >    6. https://lists.sourceforge.net/lists/listinfo/tmux-users
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to