Always format real layout even when zoomed.

This commit is contained in:
nicm 2015-04-21 22:38:49 +00:00
parent 93b2871cab
commit 69f292a90e
4 changed files with 8 additions and 4 deletions

View File

@ -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);

View File

@ -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);

2
tmux.h
View File

@ -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 */

View File

@ -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;