summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/resize.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2013-03-24 09:57:59 +0000
committernicm <nicm@openbsd.org>2013-03-24 09:57:59 +0000
commitb4a3311ed2e18a290144fc9d4b326eec29e85f98 (patch)
treef860790228b1e2701b5f74a9c885edd023ed22ba /usr.bin/tmux/resize.c
parentAdd a -o option to set-option to prevent setting an option already set, (diff)
downloadwireguard-openbsd-b4a3311ed2e18a290144fc9d4b326eec29e85f98.tar.xz
wireguard-openbsd-b4a3311ed2e18a290144fc9d4b326eec29e85f98.zip
Add resize-pane -Z to temporary zoom the active pane to occupy the full
window or unzoom (restored to the normal layout) if it already zoomed, bound to C-b z by default. The pane is unzoomed on pretty much any excuse whatsoever. We considered making this a new layout but the requirements are quite different from layouts so decided it is better as a special case. Each current layout cell is saved, a temporary one-cell layout generated and all except the active pane set to NULL. Prompted by suggestions and scripts from several. Thanks to Aaron Jensen and Thiago Padilha for testing an earlier version.
Diffstat (limited to 'usr.bin/tmux/resize.c')
-rw-r--r--usr.bin/tmux/resize.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c
index dd3ef31dee2..1f56a3a0972 100644
--- a/usr.bin/tmux/resize.c
+++ b/usr.bin/tmux/resize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resize.c,v 1.9 2013/03/21 18:46:12 nicm Exp $ */
+/* $OpenBSD: resize.c,v 1.10 2013/03/24 09:57:59 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -50,7 +50,7 @@ recalculate_sizes(void)
struct window *w;
struct window_pane *wp;
u_int i, j, ssx, ssy, has, limit;
- int flag, has_status;
+ int flag, has_status, is_zoomed;
RB_FOREACH(s, sessions, &sessions) {
has_status = options_get_number(&s->options, "status");
@@ -123,12 +123,16 @@ recalculate_sizes(void)
if (w->sx == ssx && w->sy == ssy)
continue;
-
log_debug("window size %u,%u (was %u,%u)", ssx, ssy, w->sx,
w->sy);
+ is_zoomed = w->flags & WINDOW_ZOOMED;
+ if (is_zoomed)
+ window_unzoom(w);
layout_resize(w, ssx, ssy);
window_resize(w, ssx, ssy);
+ if (is_zoomed && window_pane_visible(w->active))
+ window_zoom(w->active);
/*
* If the current pane is now not visible, move to the next