From b3e07ccd185f54cfd1ab9fb3b6091702b5bad2e2 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 21 Apr 2015 22:38:49 +0000 Subject: [PATCH] Always format real layout even when zoomed. --- usr.bin/tmux/format.c | 7 +++++-- usr.bin/tmux/layout-custom.c | 6 +++--- usr.bin/tmux/tmux.h | 4 ++-- usr.bin/tmux/window.c | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 997b12555fb..8b0538e87d4 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.62 2015/04/21 15:18:38 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.63 2015/04/21 22:38:49 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -577,7 +577,10 @@ format_defaults_window(struct format_tree *ft, struct window *w) ft->w = w; - layout = layout_dump(w); + if (w->saved_layout_root != NULL) + layout = layout_dump(w->saved_layout_root); + else + layout = layout_dump(w->layout_root); format_add(ft, "window_id", "@%u", w->id); format_add(ft, "window_name", "%s", w->name); diff --git a/usr.bin/tmux/layout-custom.c b/usr.bin/tmux/layout-custom.c index b911276b359..1180a3ac0a4 100644 --- a/usr.bin/tmux/layout-custom.c +++ b/usr.bin/tmux/layout-custom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout-custom.c,v 1.6 2013/03/25 11:35:30 nicm Exp $ */ +/* $OpenBSD: layout-custom.c,v 1.7 2015/04/21 22:38:49 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott @@ -55,12 +55,12 @@ layout_checksum(const char *layout) /* Dump layout as a string. */ char * -layout_dump(struct window *w) +layout_dump(struct layout_cell *root) { char layout[BUFSIZ], *out; *layout = '\0'; - if (layout_append(w->layout_root, layout, sizeof layout) != 0) + if (layout_append(root, layout, sizeof layout) != 0) return (NULL); xasprintf(&out, "%04x,%s", layout_checksum(layout), layout); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 87184a6869c..c8daf41d259 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.493 2015/04/20 15:34:56 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.494 2015/04/21 22:38:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2225,7 +2225,7 @@ struct layout_cell *layout_split_pane( void layout_close_pane(struct window_pane *); /* layout-custom.c */ -char *layout_dump(struct window *); +char *layout_dump(struct layout_cell *); int layout_parse(struct window *, const char *); /* layout-set.c */ diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index 64ad833348f..5ce73e31b68 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.119 2015/04/20 07:50:49 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.120 2015/04/21 22:38:50 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -519,6 +519,7 @@ window_unzoom(struct window *w) w->flags &= ~WINDOW_ZOOMED; layout_free(w); w->layout_root = w->saved_layout_root; + w->saved_layout_root = NULL; TAILQ_FOREACH(wp, &w->panes, entry) { wp->layout_cell = wp->saved_layout_cell; -- 2.20.1