summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES9
-rw-r--r--cmd-kill-session.c3
-rw-r--r--cmd-kill-window.c3
-rw-r--r--cmd-last-window.c3
-rw-r--r--cmd-link-window.c3
-rw-r--r--cmd-next-window.c3
-rw-r--r--cmd-previous-window.c3
-rw-r--r--cmd-select-window.c3
-rw-r--r--cmd-set-window-option.c18
-rw-r--r--cmd-swap-window.c3
-rw-r--r--cmd-unlink-window.c3
-rw-r--r--resize.c10
-rw-r--r--tmux.h3
13 files changed, 52 insertions, 15 deletions
diff --git a/CHANGES b/CHANGES
index 0cb36349..c6710ddc 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.
@@ -445,4 +452,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.114 2008-06-06 17:55:27 nicm Exp $
+$Id: CHANGES,v 1.115 2008-06-06 20:02:27 nicm Exp $
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index e8e4754d..909ce295 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-session.c,v 1.10 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-kill-session.c,v 1.11 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 f0b4a92a..24b12c12 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-window.c,v 1.13 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-kill-window.c,v 1.14 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 18bbf678..20a7abe9 100644
--- a/cmd-last-window.c
+++ b/cmd-last-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-last-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-last-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 ac947054..19111c1e 100644
--- a/cmd-link-window.c
+++ b/cmd-link-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-link-window.c,v 1.21 2008-06-06 17:20:15 nicm Exp $ */
+/* $Id: cmd-link-window.c,v 1.22 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 7296ffc5..aaa2ac28 100644
--- a/cmd-next-window.c
+++ b/cmd-next-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-next-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-next-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 c22155f9..5ecc3025 100644
--- a/cmd-previous-window.c
+++ b/cmd-previous-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-previous-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-previous-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 0fbbe942..11ad106b 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-select-window.c,v 1.18 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-select-window.c,v 1.19 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 bed3d3aa..70fdeff6 100644
--- a/cmd-set-window-option.c
+++ b/cmd-set-window-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-window-option.c,v 1.5 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-set-window-option.c,v 1.6 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 8cb63ca8..4593ba24 100644
--- a/cmd-swap-window.c
+++ b/cmd-swap-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-swap-window.c,v 1.12 2008-06-05 22:59:38 nicm Exp $ */
+/* $Id: cmd-swap-window.c,v 1.13 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 23a488bd..5bb7c308 100644
--- a/cmd-unlink-window.c
+++ b/cmd-unlink-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-unlink-window.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */
+/* $Id: cmd-unlink-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 c3be5719..733156db 100644
--- a/resize.c
+++ b/resize.c
@@ -1,4 +1,4 @@
-/* $Id: resize.c,v 1.11 2008-06-03 21:42:37 nicm Exp $ */
+/* $Id: resize.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 8778030e..33d8ce83 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.135 2008-06-06 17:55:27 nicm Exp $ */
+/* $Id: tmux.h,v 1.136 2008-06-06 20:02:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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;