summaryrefslogtreecommitdiffstats
authornicm <nicm>2008-06-06 20:02:27 (GMT)
committer nicm <nicm>2008-06-06 20:02:27 (GMT)
commitfea3d1631f65fe822b1320f0d6ca09607ae98fdf (patch) (side-by-side diff)
treecc29e6190cb0779e173bec56a11329c2f28f5464
parent23b0784497fa5152d9611c074270ff7c3c6a614d (diff)
downloadtmux-old-fea3d1631f65fe822b1320f0d6ca09607ae98fdf.zip
tmux-old-fea3d1631f65fe822b1320f0d6ca09607ae98fdf.tar.gz
tmux-old-fea3d1631f65fe822b1320f0d6ca09607ae98fdf.tar.bz2
New flag: aggressize resize. Resize window when to size of smallest session for which it is _current_ window.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--CHANGES7
-rw-r--r--cmd-kill-session.c1
-rw-r--r--cmd-kill-window.c1
-rw-r--r--cmd-last-window.c1
-rw-r--r--cmd-link-window.c1
-rw-r--r--cmd-next-window.c1
-rw-r--r--cmd-previous-window.c1
-rw-r--r--cmd-select-window.c1
-rw-r--r--cmd-set-window-option.c16
-rw-r--r--cmd-swap-window.c1
-rw-r--r--cmd-unlink-window.c1
-rw-r--r--resize.c8
-rw-r--r--tmux.h1
13 files changed, 39 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 992e1b7..73b317b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,12 @@
06 June 2008
+* New window option: aggressive-resize. Normally, windows are resized to the
+ size of the smallest attached session to which they are linked. This means a
+ window only changes size when sessions are detached or attached, or they are
+ linked or unlinked from a session. This flag changes a window to be the size
+ of the smallest attached session for which it is the current window - it is
+ resized every time a session changes to it or away from it. This is nice for
+ things that handle SIGWINCH well (like irssi) and bad for things like shells.
* The server now exits when no sessions remain.
* Fix bug with inserting characters with TERM=xterm-color.
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index f0e52d9..a206443 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -60,6 +60,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx)
server_write_client(c, MSG_EXIT, NULL, 0);
}
}
+ recalculate_sizes();
session_destroy(s);
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index a48dbf6..be839eb 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -63,6 +63,7 @@ cmd_kill_window_exec(struct cmd *self, struct cmd_ctx *ctx)
} else
server_redraw_client(c);
}
+ recalculate_sizes();
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
diff --git a/cmd-last-window.c b/cmd-last-window.c
index 5297164..96bae68 100644
--- a/cmd-last-window.c
+++ b/cmd-last-window.c
@@ -52,6 +52,7 @@ cmd_last_window_exec(struct cmd *self, struct cmd_ctx *ctx)
server_redraw_session(s);
else
ctx->error(ctx, "no last window");
+ recalculate_sizes();
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
diff --git a/cmd-link-window.c b/cmd-link-window.c
index c641b9b..d65b0dc 100644
--- a/cmd-link-window.c
+++ b/cmd-link-window.c
@@ -108,6 +108,7 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
session_select(s, wl_dst->idx);
server_redraw_session(s);
}
+ recalculate_sizes();
out:
if (ctx->cmdclient != NULL)
diff --git a/cmd-next-window.c b/cmd-next-window.c
index 592a6bc..c88c157 100644
--- a/cmd-next-window.c
+++ b/cmd-next-window.c
@@ -52,6 +52,7 @@ cmd_next_window_exec(struct cmd *self, struct cmd_ctx *ctx)
server_redraw_session(s);
else
ctx->error(ctx, "no next window");
+ recalculate_sizes();
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
diff --git a/cmd-previous-window.c b/cmd-previous-window.c
index a867549..80ea607 100644
--- a/cmd-previous-window.c
+++ b/cmd-previous-window.c
@@ -52,6 +52,7 @@ cmd_previous_window_exec(struct cmd *self, struct cmd_ctx *ctx)
server_redraw_session(s);
else
ctx->error(ctx, "no previous window");
+ recalculate_sizes();
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
diff --git a/cmd-select-window.c b/cmd-select-window.c
index 58334a5..e558e46 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -66,6 +66,7 @@ cmd_select_window_exec(struct cmd *self, struct cmd_ctx *ctx)
if (session_select(s, wl->idx) == 0)
server_redraw_session(s);
+ recalculate_sizes();
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
diff --git a/cmd-set-window-option.c b/cmd-set-window-option.c
index dd735f6..71763a5 100644
--- a/cmd-set-window-option.c
+++ b/cmd-set-window-option.c
@@ -150,6 +150,22 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
if (s != NULL)
session_alert_cancel(s, wl);
}
+ } else if (strcmp(data->option, "aggressive-resize") == 0) {
+ if (bool == -1) {
+ ctx->error(ctx, "bad value: %s", data->value);
+ return;
+ }
+
+ if (bool == -2)
+ wl->window->flags ^= WINDOW_AGGRESSIVE;
+ else {
+ if (bool)
+ wl->window->flags |= WINDOW_AGGRESSIVE;
+ else
+ wl->window->flags &= ~WINDOW_AGGRESSIVE;
+ }
+
+ recalculate_sizes();
} else {
ctx->error(ctx, "unknown option: %s", data->option);
return;
diff --git a/cmd-swap-window.c b/cmd-swap-window.c
index a38ea3c..304e1bf 100644
--- a/cmd-swap-window.c
+++ b/cmd-swap-window.c
@@ -70,6 +70,7 @@ cmd_swap_window_exec(struct cmd *self, struct cmd_ctx *ctx)
server_redraw_session(src);
if (src != dst)
server_redraw_session(dst);
+ recalculate_sizes();
out:
if (ctx->cmdclient != NULL)
diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c
index dcb845c..fdf5933 100644
--- a/cmd-unlink-window.c
+++ b/cmd-unlink-window.c
@@ -68,6 +68,7 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx)
} else
server_redraw_client(c);
}
+ recalculate_sizes();
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
diff --git a/resize.c b/resize.c
index e44c850..19ac8b5 100644
--- a/resize.c
+++ b/resize.c
@@ -48,7 +48,7 @@ recalculate_sizes(void)
struct session *s;
struct client *c;
struct window *w;
- u_int i, j, ssx, ssy, slines;
+ u_int i, j, ssx, ssy, slines, has;
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);
@@ -97,7 +97,11 @@ recalculate_sizes(void)
s = ARRAY_ITEM(&sessions, j);
if (s == NULL || s->flags & SESSION_UNATTACHED)
continue;
- if (session_has(s, w)) {
+ if (w->flags & WINDOW_AGGRESSIVE)
+ has = s->curw->window == w;
+ else
+ has = session_has(s, w);
+ if (has) {
if (s->sx < ssx)
ssx = s->sx;
if (s->sy < ssy)
diff --git a/tmux.h b/tmux.h
index 5df63d4..1557284 100644
--- a/tmux.h
+++ b/tmux.h
@@ -527,6 +527,7 @@ struct window {
#define WINDOW_HIDDEN 0x2
#define WINDOW_ACTIVITY 0x4
#define WINDOW_MONITOR 0x8
+#define WINDOW_AGGRESSIVE 0x10
struct screen *screen;
struct screen base;