diff --git a/client.c b/client.c
index ef0ebe78..4ac68243 100644
--- a/client.c
+++ b/client.c
@@ -1,4 +1,4 @@
-/* $Id: client.c,v 1.89 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: client.c,v 1.90 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -129,7 +129,7 @@ client_send_identify(int flags)
 
 	if (getcwd(data.cwd, sizeof data.cwd) == NULL)
 		*data.cwd = '\0';
-	
+
 	term = getenv("TERM");
 	if (term == NULL ||
 	    strlcpy(data.term, term, sizeof data.term) >= sizeof data.term)
@@ -147,7 +147,7 @@ client_send_environ(void)
 	struct msg_environ_data	data;
 	char		      **var;
 
- 	for (var = environ; *var != NULL; var++) {
+	for (var = environ; *var != NULL; var++) {
 		if (strlcpy(data.var, *var, sizeof data.var) >= sizeof data.var)
 			continue;
 		client_write_server(MSG_ENVIRON, &data, sizeof data);
@@ -157,7 +157,7 @@ client_send_environ(void)
 void
 client_write_server(enum msgtype type, void *buf, size_t len)
 {
- 	imsg_compose(&client_ibuf, type, PROTOCOL_VERSION, -1, -1, buf, len);
+	imsg_compose(&client_ibuf, type, PROTOCOL_VERSION, -1, -1, buf, len);
 }
 
 void
@@ -183,7 +183,7 @@ client_main(void)
 
 	/* Note: event_init() has already been called. */
 
- 	/* Set up signals. */
+	/* Set up signals. */
 	memset(&sigact, 0, sizeof sigact);
 	sigemptyset(&sigact.sa_mask);
 	sigact.sa_flags = SA_RESTART;
@@ -267,9 +267,9 @@ client_callback(unused int fd, short events, unused void *data)
 		if (client_dispatch() != 0) {
 			event_loopexit(NULL);
 			return;
-		}	
+		}
 	}
-	
+
 	if (events & EV_WRITE) {
 		if (msgbuf_write(&client_ibuf.w) < 0)
 			goto lost_server;
@@ -345,7 +345,7 @@ client_dispatch(void)
 			if (datalen != sizeof lockdata)
 				fatalx("bad MSG_LOCK size");
 			memcpy(&lockdata, imsg.data, sizeof lockdata);
-			
+
 			lockdata.cmd[(sizeof lockdata.cmd) - 1] = '\0';
 			system(lockdata.cmd);
 			client_write_server(MSG_UNLOCK, NULL, 0);
diff --git a/clock.c b/clock.c
index 059b277d..5c0a2400 100644
--- a/clock.c
+++ b/clock.c
@@ -1,4 +1,4 @@
-/* $Id: clock.c,v 1.8 2009-11-28 14:57:59 tcunha Exp $ */
+/* $Id: clock.c,v 1.9 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -134,13 +134,13 @@ clock_draw(struct screen_write_ctx *ctx, int colour, int style)
 	for (ptr = tim; *ptr != '\0'; ptr++) {
 		if (*ptr >= '0' && *ptr <= '9')
 			idx = *ptr - '0';
- 		else if (*ptr == ':')
+		else if (*ptr == ':')
 			idx = 10;
- 		else if (*ptr == 'A')
+		else if (*ptr == 'A')
 			idx = 11;
- 		else if (*ptr == 'P')
+		else if (*ptr == 'P')
 			idx = 12;
- 		else if (*ptr == 'M')
+		else if (*ptr == 'M')
 			idx = 13;
 		else {
 			x += 6;
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index 13d0ff54..e55f7c46 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-attach-session.c,v 1.34 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-attach-session.c,v 1.35 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,7 +29,7 @@ int	cmd_attach_session_exec(struct cmd *, struct cmd_ctx *);
 const struct cmd_entry cmd_attach_session_entry = {
 	"attach-session", "attach",
 	"[-d] " CMD_TARGET_SESSION_USAGE,
-       	CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "d",
+	CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "d",
 	cmd_target_init,
 	cmd_target_parse,
 	cmd_attach_session_exec,
@@ -59,7 +59,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 
 	if (ctx->cmdclient == NULL) {
 		if (cmd_check_flag(data->chflags, 'd')) {
-			/* 
+			/*
 			 * Can't use server_write_session in case attaching to
 			 * the same session as currently attached to.
 			 */
@@ -72,7 +72,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 				server_write_client(c, MSG_DETACH, NULL, 0);
 			}
 		}
-		
+
 		ctx->curclient->session = s;
 		server_redraw_client(ctx->curclient);
 	} else {
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index e20a75b1..6f292629 100644
--- a/cmd-bind-key.c
+++ b/cmd-bind-key.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-bind-key.c,v 1.26 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-bind-key.c,v 1.27 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -152,7 +152,7 @@ cmd_bind_key_table(struct cmd *self, struct cmd_ctx *ctx)
 		ctx->error(ctx, "unknown command: %s", data->modecmd);
 		return (-1);
 	}
-	
+
 	mtmp.key = data->key & ~KEYC_PREFIX;
 	mtmp.mode = data->command_key ? 1 : 0;
 	if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 6c01ca4b..dd9bdaf9 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-break-pane.c,v 1.10 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-break-pane.c,v 1.11 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -64,18 +64,18 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 		if (wl->window->active == NULL)
 			wl->window->active = TAILQ_NEXT(wp, entry);
 	}
- 	layout_close_pane(wp);
+	layout_close_pane(wp);
 
- 	w = wp->window = window_create1(s->sx, s->sy);
- 	TAILQ_INSERT_HEAD(&w->panes, wp, entry);
- 	w->active = wp;
- 	w->name = default_window_name(w);
+	w = wp->window = window_create1(s->sx, s->sy);
+	TAILQ_INSERT_HEAD(&w->panes, wp, entry);
+	w->active = wp;
+	w->name = default_window_name(w);
 	layout_init(w);
 
 	base_idx = options_get_number(&s->options, "base-index");
- 	wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */
- 	if (!cmd_check_flag(data->chflags, 'd'))
- 		session_select(s, wl->idx);
+	wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */
+	if (!cmd_check_flag(data->chflags, 'd'))
+		session_select(s, wl->idx);
 
 	server_redraw_session(s);
 	server_status_session_group(s);
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index 9830c444..ef33947e 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-capture-pane.c,v 1.1 2009-12-02 15:10:44 tcunha Exp $ */
+/* $Id: cmd-capture-pane.c,v 1.2 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net>
@@ -48,7 +48,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 	struct screen		*s;
 	struct session		*sess;
 	u_int			 i, limit;
-	size_t         		 len, linelen; 
+	size_t         		 len, linelen;
 
 	if (cmd_find_pane(ctx, data->target, &sess, &wp) == NULL)
 		return (-1);
diff --git a/cmd-choose-window.c b/cmd-choose-window.c
index 6cff98c4..ce45dc7a 100644
--- a/cmd-choose-window.c
+++ b/cmd-choose-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-choose-window.c,v 1.19 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-choose-window.c,v 1.20 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -116,10 +116,10 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 	cdata->client = ctx->curclient;
 	cdata->client->references++;
 
-	window_choose_ready(wl->window->active, 
+	window_choose_ready(wl->window->active,
 	    cur, cmd_choose_window_callback, cmd_choose_window_free, cdata);
 
- 	return (0);
+	return (0);
 }
 
 void
@@ -133,7 +133,7 @@ cmd_choose_window_callback(void *data, int idx)
 	if (idx == -1)
 		return;
 	if (cdata->client->flags & CLIENT_DEAD)
-		return;	
+		return;
 	if (cdata->session->flags & SESSION_DEAD)
 		return;
 	if (cdata->client->session != cdata->session)
diff --git a/cmd-generic.c b/cmd-generic.c
index 275bbf57..d3845d43 100644
--- a/cmd-generic.c
+++ b/cmd-generic.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-generic.c,v 1.37 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: cmd-generic.c,v 1.38 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -141,7 +141,7 @@ cmd_fill_argument(int flags, char **arg, char **arg2, int argc, char **argv)
 		if (argc == 2)
 			*arg2 = xstrdup(argv[1]);
 		return (0);
-	}		
+	}
 
 	if (argc != 0)
 		return (-1);
@@ -225,9 +225,9 @@ cmd_target_print(struct cmd *self, char *buf, size_t len)
 	off += cmd_print_flags(buf, len, off, data->chflags);
 	if (off < len && data->target != NULL)
 		off += cmd_prarg(buf + off, len - off, " -t ", data->target);
- 	if (off < len && data->arg != NULL)
+	if (off < len && data->arg != NULL)
 		off += cmd_prarg(buf + off, len - off, " ", data->arg);
- 	if (off < len && data->arg2 != NULL)
+	if (off < len && data->arg2 != NULL)
 		off += cmd_prarg(buf + off, len - off, " ", data->arg2);
 	return (off);
 }
@@ -317,9 +317,9 @@ cmd_srcdst_print(struct cmd *self, char *buf, size_t len)
 		off += xsnprintf(buf + off, len - off, " -s %s", data->src);
 	if (off < len && data->dst != NULL)
 		off += xsnprintf(buf + off, len - off, " -t %s", data->dst);
- 	if (off < len && data->arg != NULL)
+	if (off < len && data->arg != NULL)
 		off += cmd_prarg(buf + off, len - off, " ", data->arg);
- 	if (off < len && data->arg2 != NULL)
+	if (off < len && data->arg2 != NULL)
 		off += cmd_prarg(buf + off, len - off, " ", data->arg2);
 	return (off);
 }
@@ -415,9 +415,9 @@ cmd_buffer_print(struct cmd *self, char *buf, size_t len)
 		off += xsnprintf(buf + off, len - off, " -b %d", data->buffer);
 	if (off < len && data->target != NULL)
 		off += cmd_prarg(buf + off, len - off, " -t ", data->target);
- 	if (off < len && data->arg != NULL)
+	if (off < len && data->arg != NULL)
 		off += cmd_prarg(buf + off, len - off, " ", data->arg);
- 	if (off < len && data->arg2 != NULL)
+	if (off < len && data->arg2 != NULL)
 		off += cmd_prarg(buf + off, len - off, " ", data->arg2);
 	return (off);
 }
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index 28b729f5..eb2bde0b 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-session.c,v 1.16 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-kill-session.c,v 1.17 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -45,7 +45,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 {
 	struct cmd_target_data	*data = self->data;
 	struct session		*s;
- 	struct client		*c;
+	struct client		*c;
 	u_int			 i;
 
 	if ((s = cmd_find_session(ctx, data->target)) == NULL)
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index 287736ab..deb1a175 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-buffers.c,v 1.14 2009-11-28 14:54:12 tcunha Exp $ */
+/* $Id: cmd-list-buffers.c,v 1.15 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -70,7 +70,7 @@ cmd_list_buffers_exec(struct cmd *self, struct cmd_ctx *ctx)
 			tmp[50 - 3] = '\0';
 			strlcat(tmp, "...", sizeof tmp);
 		}
-		
+
 		ctx->print(ctx, "%u: %zu bytes: \"%s\"", idx - 1, size, tmp);
 	}
 
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index b0e34272..80845211 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-keys.c,v 1.23 2009-11-19 22:15:58 tcunha Exp $ */
+/* $Id: cmd-list-keys.c,v 1.24 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -75,7 +75,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
 		if (used >= sizeof tmp)
 			continue;
 
- 		if (!(bd->key & KEYC_PREFIX)) {
+		if (!(bd->key & KEYC_PREFIX)) {
 			used = strlcat(tmp, "(no prefix) ", sizeof tmp);
 			if (used >= sizeof tmp)
 				continue;
diff --git a/cmd-list-panes.c b/cmd-list-panes.c
index 4292786a..a075cf38 100644
--- a/cmd-list-panes.c
+++ b/cmd-list-panes.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-panes.c,v 1.3 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-list-panes.c,v 1.4 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -23,7 +23,7 @@
 #include "tmux.h"
 
 /*
- * List panes on given window..
+ * List panes on given window.
  */
 
 int	cmd_list_panes_exec(struct cmd *, struct cmd_ctx *);
@@ -56,7 +56,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx)
 	n = 0;
 	TAILQ_FOREACH(wp, &wl->window->panes, entry) {
 		gd = wp->base.grid;
-		
+
 		size = 0;
 		for (i = 0; i < gd->hsize; i++) {
 			gl = &gd->linedata[i];
@@ -64,7 +64,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx)
 			size += gl->utf8size * sizeof *gl->utf8data;
 		}
 		size += gd->hsize * sizeof *gd->linedata;
-		
+
 		ctx->print(ctx, "%u: [%ux%u] [history %u/%u, %llu bytes]",
 		    n, wp->sx, wp->sy, gd->hsize, gd->hlimit, size);
 		n++;
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 6484dc5e..5d12b267 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-session.c,v 1.72 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: cmd-new-session.c,v 1.73 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -184,8 +184,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 			ctx->error(ctx, "not a terminal");
 			return (-1);
 		}
-		
-		overrides = 
+
+		overrides =
 		    options_get_string(&global_s_options, "terminal-overrides");
 		if (tty_open(&ctx->cmdclient->tty, overrides, &cause) != 0) {
 			ctx->error(ctx, "open terminal failed: %s", cause);
@@ -267,13 +267,13 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
 	 * Set the client to the new session. If a command client exists, it is
 	 * taking this session and needs to get MSG_READY and stay around.
 	 */
- 	if (!detached) {
+	if (!detached) {
 		if (ctx->cmdclient != NULL) {
 			server_write_client(ctx->cmdclient, MSG_READY, NULL, 0);
- 			ctx->cmdclient->session = s;
+			ctx->cmdclient->session = s;
 			server_redraw_client(ctx->cmdclient);
 		} else {
- 			ctx->curclient->session = s;
+			ctx->curclient->session = s;
 			server_redraw_client(ctx->curclient);
 		}
 	}
diff --git a/cmd-new-window.c b/cmd-new-window.c
index 0b537021..a052c273 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-window.c,v 1.41 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: cmd-new-window.c,v 1.42 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -166,7 +166,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 	if (!data->flag_detached) {
 		session_select(s, wl->idx);
 		server_redraw_session_group(s);
-	} else	
+	} else
 		server_status_session_group(s);
 
 	return (0);
diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c
index 7860e3a7..e16d3407 100644
--- a/cmd-paste-buffer.c
+++ b/cmd-paste-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-paste-buffer.c,v 1.23 2009-11-28 14:54:12 tcunha Exp $ */
+/* $Id: cmd-paste-buffer.c,v 1.24 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -78,7 +78,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
 			paste_free_index(&s->buffers, data->buffer);
 	}
 
- 	return (0);
+	return (0);
 }
 
 /* Add bytes to a buffer but change every '\n' to '\r'. */
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index 19f3f018..19611893 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-pipe-pane.c,v 1.9 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: cmd-pipe-pane.c,v 1.10 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -86,7 +86,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 	switch (fork()) {
 	case -1:
 		ctx->error(ctx, "fork error: %s", strerror(errno));
-		return (-1);		
+		return (-1);
 	case 0:
 		/* Child process. */
 		close(pipe_fd[0]);
@@ -113,17 +113,17 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 
 		wp->pipe_fd = pipe_fd[0];
 		wp->pipe_off = EVBUFFER_LENGTH(wp->event->input);
-		
+
 		wp->pipe_event = bufferevent_new(wp->pipe_fd,
 		    NULL, NULL, cmd_pipe_pane_error_callback, wp);
 		bufferevent_enable(wp->pipe_event, EV_WRITE);
-		
+
 		if ((mode = fcntl(wp->pipe_fd, F_GETFL)) == -1)
 			fatal("fcntl failed");
 		if (fcntl(wp->pipe_fd, F_SETFL, mode|O_NONBLOCK) == -1)
 			fatal("fcntl failed");
 		if (fcntl(wp->pipe_fd, F_SETFD, FD_CLOEXEC) == -1)
-			fatal("fcntl failed");	
+			fatal("fcntl failed");
 		return (0);
 	}
 }
diff --git a/cmd-previous-layout.c b/cmd-previous-layout.c
index 26435035..1d04c600 100644
--- a/cmd-previous-layout.c
+++ b/cmd-previous-layout.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-previous-layout.c,v 1.5 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-previous-layout.c,v 1.6 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -43,7 +43,7 @@ cmd_previous_layout_exec(struct cmd *self, struct cmd_ctx *ctx)
 	struct cmd_target_data	*data = self->data;
 	struct winlink		*wl;
 	u_int			 layout;
-	
+
 	if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
 		return (-1);
 
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index d281747d..a608c5e5 100644
--- a/cmd-resize-pane.c
+++ b/cmd-resize-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-resize-pane.c,v 1.13 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-resize-pane.c,v 1.14 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,7 +56,7 @@ cmd_resize_pane_init(struct cmd *self, int key)
 		cmd_set_flag(&data->chflags, 'L');
 	if (key == (KEYC_RIGHT | KEYC_CTRL))
 		cmd_set_flag(&data->chflags, 'R');
-	
+
 	if (key == (KEYC_UP | KEYC_ESCAPE)) {
 		cmd_set_flag(&data->chflags, 'U');
 		data->arg = xstrdup("5");
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index 0cfa46d7..79f77376 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-respawn-window.c,v 1.24 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-respawn-window.c,v 1.25 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -72,7 +72,7 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 	wp = TAILQ_FIRST(&w->panes);
 	TAILQ_REMOVE(&w->panes, wp, entry);
 	layout_free(w);
- 	window_destroy_panes(w);
+	window_destroy_panes(w);
 	TAILQ_INSERT_HEAD(&w->panes, wp, entry);
 	window_pane_resize(wp, w->sx, w->sy);
 	if (window_pane_spawn(
diff --git a/cmd-select-layout.c b/cmd-select-layout.c
index 3b57d202..c4f96926 100644
--- a/cmd-select-layout.c
+++ b/cmd-select-layout.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-select-layout.c,v 1.9 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-select-layout.c,v 1.10 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -52,7 +52,7 @@ cmd_select_layout_init(struct cmd *self, int key)
 		break;
 	case ('2' | KEYC_ESCAPE):
 		data->arg = xstrdup("even-vertical");
-    		break;
+		break;
 	case ('3' | KEYC_ESCAPE):
 		data->arg = xstrdup("main-horizontal");
 		break;
@@ -80,7 +80,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx)
 		ctx->error(ctx, "unknown layout or ambiguous: %s", data->arg);
 		return (-1);
 	}
-	
+
 	layout = layout_set_select(wl->window, layout);
 	ctx->info(ctx, "arranging in: %s", layout_set_name(layout));
 
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 48f72407..70a57717 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-send-keys.c,v 1.23 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-send-keys.c,v 1.24 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -33,7 +33,7 @@ size_t	cmd_send_keys_print(struct cmd *, char *, size_t);
 
 struct cmd_send_keys_data {
 	char	*target;
-  	u_int	 nkeys;
+	u_int	 nkeys;
 	int	*keys;
 };
 
diff --git a/cmd-server-info.c b/cmd-server-info.c
index 9deda7d3..c35e51b8 100644
--- a/cmd-server-info.c
+++ b/cmd-server-info.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-server-info.c,v 1.35 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: cmd-server-info.c,v 1.36 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -94,12 +94,12 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
 		ctx->print(ctx, "%2d: %s (%d, %d): %s [%ux%u %s] "
 		    "[flags=0x%x/0x%x, references=%u]", i, c->tty.path,
 		    c->ibuf.fd, c->tty.fd, c->session->name,
-		    c->tty.sx, c->tty.sy, c->tty.termname, c->flags, 
+		    c->tty.sx, c->tty.sy, c->tty.termname, c->flags,
 		    c->tty.flags, c->references);
 	}
 	ctx->print(ctx, "%s", "");
 
- 	ctx->print(ctx, "Sessions: [%zu/%zu]",
+	ctx->print(ctx, "Sessions: [%zu/%zu]",
 	    sizeof (struct grid_cell), sizeof (struct grid_utf8));
 	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
 		s = ARRAY_ITEM(&sessions, i);
@@ -148,7 +148,7 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
 	}
 	ctx->print(ctx, "%s", "");
 
-  	ctx->print(ctx, "Terminals:");
+	ctx->print(ctx, "Terminals:");
 	SLIST_FOREACH(term, &tty_terms, entry) {
 		ctx->print(ctx, "%s [references=%u, flags=0x%x]:",
 		    term->name, term->references, term->flags);
@@ -180,7 +180,7 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
 	}
 	ctx->print(ctx, "%s", "");
 
-  	ctx->print(ctx, "Jobs:");
+	ctx->print(ctx, "Jobs:");
 	SLIST_FOREACH(job, &all_jobs, lentry) {
 		ctx->print(ctx, "%s [fd=%d, pid=%d, status=%d, flags=0x%x]",
 		    job->cmd, job->fd, job->pid, job->status, job->flags);
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 2e0074b6..50efb4f2 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-option.c,v 1.88 2009-12-04 22:11:23 tcunha Exp $ */
+/* $Id: cmd-set-option.c,v 1.89 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,17 +34,17 @@ const char *cmd_set_option_print(
 void	cmd_set_option_string(struct cmd_ctx *,
 	    struct options *, const struct set_option_entry *, char *, int);
 void	cmd_set_option_number(struct cmd_ctx *,
-    	    struct options *, const struct set_option_entry *, char *);
+	    struct options *, const struct set_option_entry *, char *);
 void	cmd_set_option_keys(struct cmd_ctx *,
-    	    struct options *, const struct set_option_entry *, char *);
+	    struct options *, const struct set_option_entry *, char *);
 void	cmd_set_option_colour(struct cmd_ctx *,
-    	    struct options *, const struct set_option_entry *, char *);
+	    struct options *, const struct set_option_entry *, char *);
 void	cmd_set_option_attributes(struct cmd_ctx *,
-    	    struct options *, const struct set_option_entry *, char *);
+	    struct options *, const struct set_option_entry *, char *);
 void	cmd_set_option_flag(struct cmd_ctx *,
-    	    struct options *, const struct set_option_entry *, char *);
+	    struct options *, const struct set_option_entry *, char *);
 void	cmd_set_option_choice(struct cmd_ctx *,
-    	    struct options *, const struct set_option_entry *, char *);
+	    struct options *, const struct set_option_entry *, char *);
 
 const struct cmd_entry cmd_set_option_entry = {
 	"set-option", "set",
@@ -103,7 +103,7 @@ const struct set_option_entry set_session_option_table[] = {
 	{ "status-bg", SET_OPTION_COLOUR, 0, 0, NULL },
 	{ "status-fg", SET_OPTION_COLOUR, 0, 0, NULL },
 	{ "status-interval", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
-	{ "status-justify", 
+	{ "status-justify",
 	  SET_OPTION_CHOICE, 0, 0, set_option_status_justify_list },
 	{ "status-keys", SET_OPTION_CHOICE, 0, 0, set_option_status_keys_list },
 	{ "status-left", SET_OPTION_STRING, 0, 0, NULL },
@@ -116,11 +116,11 @@ const struct set_option_entry set_session_option_table[] = {
 	{ "status-right-bg", SET_OPTION_COLOUR, 0, 0, NULL },
 	{ "status-right-fg", SET_OPTION_COLOUR, 0, 0, NULL },
 	{ "status-right-length", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
-	{ "status-utf8", SET_OPTION_FLAG, 0, 0, NULL },	
+	{ "status-utf8", SET_OPTION_FLAG, 0, 0, NULL },
 	{ "terminal-overrides", SET_OPTION_STRING, 0, 0, NULL },
 	{ "update-environment", SET_OPTION_STRING, 0, 0, NULL },
 	{ "visual-activity", SET_OPTION_FLAG, 0, 0, NULL },
-	{ "visual-bell", SET_OPTION_FLAG, 0, 0, NULL },	
+	{ "visual-bell", SET_OPTION_FLAG, 0, 0, NULL },
 	{ "visual-content", SET_OPTION_FLAG, 0, 0, NULL },
 	{ NULL, 0, 0, 0, NULL }
 };
@@ -266,7 +266,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
 			server_redraw_client(c);
 	}
 
-	/* 
+	/*
 	 * Special-case: kill all persistent jobs if status-left, status-right
 	 * or set-titles-string have changed. Persistent jobs are only used by
 	 * the status line at the moment so this works XXX.
@@ -282,7 +282,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
 
 			jobs = &c->status_jobs;
 			do {
-				try_again = 0;	
+				try_again = 0;
 				job = RB_ROOT(jobs);
 				while (job != NULL) {
 					nextjob = RB_NEXT(jobs, jobs, job);
@@ -366,7 +366,7 @@ cmd_set_option_string(struct cmd_ctx *ctx, struct options *oo,
 		xasprintf(&newvalue, "%s%s", oldvalue, value);
 	} else
 		newvalue = value;
-		
+
 	o = options_set_string(oo, entry->name, "%s", newvalue);
 	ctx->info(ctx,
 	    "set option: %s -> %s", o->name, cmd_set_option_print(entry, o));
diff --git a/cmd-show-buffer.c b/cmd-show-buffer.c
index a7b88d81..d7e3e394 100644
--- a/cmd-show-buffer.c
+++ b/cmd-show-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-buffer.c,v 1.11 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-show-buffer.c,v 1.12 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -71,24 +71,24 @@ cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
 	width = s->sx;
 	if (ctx->cmdclient != NULL)
 		width = ctx->cmdclient->tty.sx;
-	
+
 	buf = xmalloc(width + 1);
 	len = 0;
-	
+
 	ptr = in;
 	do {
 		buf[len++] = *ptr++;
-		
+
 		if (len == width || buf[len - 1] == '\n') {
 			if (buf[len - 1] == '\n')
 				len--;
 			buf[len] = '\0';
 
-			ctx->print(ctx, "%s", buf);		
+			ctx->print(ctx, "%s", buf);
 			len = 0;
 		}
 	} while (*ptr != '\0');
-	
+
 	if (len != 0) {
 		buf[len] = '\0';
 		ctx->print(ctx, "%s", buf);
diff --git a/cmd-show-messages.c b/cmd-show-messages.c
index c92107a3..f533ed92 100644
--- a/cmd-show-messages.c
+++ b/cmd-show-messages.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-messages.c,v 1.1 2009-11-19 22:20:04 tcunha Exp $ */
+/* $Id: cmd-show-messages.c,v 1.2 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -57,7 +57,7 @@ cmd_show_messages_exec(struct cmd *self, struct cmd_ctx *ctx)
 
 		tim = ctime(&msg->msg_time);
 		*strchr(tim, '\n') = '\0';
-		
+
 		ctx->print(ctx, "%s %s", tim, msg->msg);
 	}
 
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 94095676..26d73e2a 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-options.c,v 1.19 2009-12-04 22:11:23 tcunha Exp $ */
+/* $Id: cmd-show-options.c,v 1.20 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -43,7 +43,7 @@ const struct cmd_entry cmd_show_options_entry = {
 int
 cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
 {
-	struct cmd_target_data		*data = self->data;	
+	struct cmd_target_data		*data = self->data;
 	const struct set_option_entry	*table;
 	struct session			*s;
 	struct winlink			*wl;
diff --git a/cmd-split-window.c b/cmd-split-window.c
index c21160fe..3dfe2ea8 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-split-window.c,v 1.30 2009-11-22 00:12:33 tcunha Exp $ */
+/* $Id: cmd-split-window.c,v 1.31 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -69,7 +69,7 @@ cmd_split_window_init(struct cmd *self, int key)
 	switch (key) {
 	case '%':
 		data->flag_horizontal = 1;
-		break;		
+		break;
 	case '"':
 		data->flag_horizontal = 0;
 		break;
diff --git a/cmd-string.c b/cmd-string.c
index 8737e850..b10ea6a8 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-string.c,v 1.28 2009-11-28 14:45:30 tcunha Exp $ */
+/* $Id: cmd-string.c,v 1.29 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -121,7 +121,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
 		case EOF:
 		case ' ':
 		case '\t':
- 			if (have_arg) {
+			if (have_arg) {
 				buf = xrealloc(buf, 1, len + 1);
 				buf[len] = '\0';
 
diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c
index eab57367..02ec607c 100644
--- a/cmd-swap-pane.c
+++ b/cmd-swap-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-swap-pane.c,v 1.14 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-swap-pane.c,v 1.15 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -110,7 +110,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
 	dst_wp->layout_cell = src_lc;
 	dst_lc->wp = src_wp;
 	src_wp->layout_cell = dst_lc;
-	
+
 	src_wp->window = dst_w;
 	dst_wp->window = src_w;
 
diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c
index 967d4655..5ded5dcb 100644
--- a/cmd-unlink-window.c
+++ b/cmd-unlink-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-unlink-window.c,v 1.20 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-unlink-window.c,v 1.21 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -63,7 +63,7 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 		ctx->error(ctx, "window is only linked to one session");
 		return (-1);
 	}
-	
+
 	server_unlink_window(s, wl);
 	recalculate_sizes();
 
diff --git a/cmd.c b/cmd.c
index 2f327b54..8ebbcfe7 100644
--- a/cmd.c
+++ b/cmd.c
@@ -1,4 +1,4 @@
-/* $Id: cmd.c,v 1.133 2009-12-02 15:10:44 tcunha Exp $ */
+/* $Id: cmd.c,v 1.134 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -168,7 +168,7 @@ cmd_free_argv(int argc, char **argv)
 	int	i;
 
 	if (argc == 0)
-		return; 
+		return;
 	for (i = 0; i < argc; i++) {
 		if (argv[i] != NULL)
 			xfree(argv[i]);
@@ -509,7 +509,7 @@ cmd_lookup_session(const char *name, int *ambiguous)
 	 * be unique so an exact match can't be ambigious and can just be
 	 * returned.
 	 */
-	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {	
+	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
 		if ((s = ARRAY_ITEM(&sessions, i)) == NULL)
 			continue;
 		if (strcmp(name, s->name) == 0)
@@ -521,7 +521,7 @@ cmd_lookup_session(const char *name, int *ambiguous)
 	 * be ambiguous.
 	 */
 	sfound = NULL;
-	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {	
+	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
 		if ((s = ARRAY_ITEM(&sessions, i)) == NULL)
 			continue;
 		if (strncmp(name, s->name, strlen(name)) == 0 ||
@@ -533,7 +533,7 @@ cmd_lookup_session(const char *name, int *ambiguous)
 			sfound = s;
 		}
 	}
- 	return (sfound);
+	return (sfound);
 }
 
 /*
@@ -557,7 +557,7 @@ cmd_lookup_window(struct session *s, const char *name, int *ambiguous)
 		if ((wl = winlink_find_by_index(&s->windows, idx)) != NULL)
 			return (wl);
 	}
-		
+
 	/* Look for exact matches, error if more than one. */
 	wlfound = NULL;
 	RB_FOREACH(wl, winlinks, &s->windows) {
@@ -583,7 +583,7 @@ cmd_lookup_window(struct session *s, const char *name, int *ambiguous)
 			}
 			wlfound = wl;
 		}
-	}	
+	}
 	if (wlfound != NULL)
 		return (wlfound);
 
@@ -706,7 +706,7 @@ cmd_find_window(struct cmd_ctx *ctx, const char *arg, struct session **sp)
 		wl = s->curw;
 	else if ((wl = cmd_lookup_window(s, winptr, &ambiguous)) == NULL)
 		goto not_found;
-	
+
 	if (sessptr != NULL)
 		xfree(sessptr);
 	return (wl);
@@ -807,7 +807,7 @@ cmd_find_index(struct cmd_ctx *ctx, const char *arg, struct session **sp)
 		ctx->error(ctx, "invalid index: %s", arg);
 		idx = -2;
 	}
-	
+
 	if (sessptr != NULL)
 		xfree(sessptr);
 	return (idx);
@@ -829,7 +829,7 @@ no_colon:
 
 no_session:
 	if (ambiguous)
- 		ctx->error(ctx, "multiple sessions: %s", arg);
+		ctx->error(ctx, "multiple sessions: %s", arg);
 	else
 		ctx->error(ctx, "session not found: %s", arg);
 	if (sessptr != NULL)
@@ -917,7 +917,7 @@ no_period:
 	/* Try index in the current session and window. */
 	if ((*wpp = window_pane_at_index(s->curw->window, idx)) == NULL)
 		goto lookup_window;
-	
+
 	return (s->curw);
 
 lookup_window:
@@ -925,7 +925,7 @@ lookup_window:
 	if ((wl = cmd_find_window(ctx, arg, sp)) != NULL)
 		*wpp = wl->window->active;
 	return (wl);
-	
+
 error:
 	xfree(winptr);
 	return (NULL);
diff --git a/grid-utf8.c b/grid-utf8.c
index 389c356e..5eb94a3e 100644
--- a/grid-utf8.c
+++ b/grid-utf8.c
@@ -1,4 +1,4 @@
-/* $Id: grid-utf8.c,v 1.1 2009-11-19 22:23:27 tcunha Exp $ */
+/* $Id: grid-utf8.c,v 1.2 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -92,5 +92,5 @@ grid_utf8_compare(const struct grid_utf8 *gu1, const struct grid_utf8 *gu2)
 		return (0);
 	if (memcmp(gu1->data, gu2->data, size) != 0)
 		return (0);
-	return (1);	
+	return (1);
 }
diff --git a/grid-view.c b/grid-view.c
index 1a04f157..98624e10 100644
--- a/grid-view.c
+++ b/grid-view.c
@@ -1,4 +1,4 @@
-/* $Id: grid-view.c,v 1.19 2009-10-15 01:55:12 tcunha Exp $ */
+/* $Id: grid-view.c,v 1.20 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -149,7 +149,7 @@ grid_view_insert_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
 
 	ny2 = rlower + 1 - py - ny;
 	grid_move_lines(gd, rlower + 1 - ny2, py, ny2);
- 	grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
+	grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
 }
 
 /* Delete lines. */
@@ -165,7 +165,7 @@ grid_view_delete_lines(struct grid *gd, u_int py, u_int ny)
 	sy = grid_view_y(gd, gd->sy);
 
 	grid_move_lines(gd, py, py + ny, sy - py - ny);
- 	grid_clear(gd, 0, sy - ny, gd->sx, py + ny - (sy - ny));
+	grid_clear(gd, 0, sy - ny, gd->sx, py + ny - (sy - ny));
 }
 
 /* Delete lines inside scroll region. */
@@ -182,7 +182,7 @@ grid_view_delete_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
 
 	ny2 = rlower + 1 - py - ny;
 	grid_move_lines(gd, py, py + ny, ny2);
- 	grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
+	grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
 }
 
 /* Insert characters. */
diff --git a/grid.c b/grid.c
index 53b29e39..be6e4d58 100644
--- a/grid.c
+++ b/grid.c
@@ -1,4 +1,4 @@
-/* $Id: grid.c,v 1.35 2009-11-19 22:23:27 tcunha Exp $ */
+/* $Id: grid.c,v 1.36 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -170,7 +170,7 @@ grid_collect_history(struct grid *gd)
 {
 	u_int	yy;
 
- 	GRID_DEBUG(gd, "");
+	GRID_DEBUG(gd, "");
 
 	if (gd->hsize < gd->hlimit)
 		return;
@@ -183,7 +183,7 @@ grid_collect_history(struct grid *gd)
 	gd->hsize -= yy;
 }
 
-/* 
+/*
  * Scroll the entire visible screen, moving one line into the history. Just
  * allocate a new line at the bottom and move the history size indicator.
  */
@@ -192,12 +192,12 @@ grid_scroll_history(struct grid *gd)
 {
 	u_int	yy;
 
- 	GRID_DEBUG(gd, "");
+	GRID_DEBUG(gd, "");
 
 	yy = gd->hsize + gd->sy;
 	gd->linedata = xrealloc(gd->linedata, yy + 1, sizeof *gd->linedata);
 	memset(&gd->linedata[yy], 0, sizeof gd->linedata[yy]);
-	
+
 	gd->hsize++;
 }
 
@@ -208,7 +208,7 @@ grid_scroll_history_region(struct grid *gd, u_int upper, u_int lower)
 	struct grid_line	*gl_history, *gl_upper, *gl_lower;
 	u_int			 yy;
 
- 	GRID_DEBUG(gd, "upper=%u, lower=%u", upper, lower);
+	GRID_DEBUG(gd, "upper=%u, lower=%u", upper, lower);
 
 	/* Create a space for a new line. */
 	yy = gd->hsize + gd->sy;
@@ -354,7 +354,7 @@ grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny)
 {
 	u_int	xx, yy;
 
- 	GRID_DEBUG(gd, "px=%u, py=%u, nx=%u, ny=%u", px, py, nx, ny);
+	GRID_DEBUG(gd, "px=%u, py=%u, nx=%u, ny=%u", px, py, nx, ny);
 
 	if (nx == 0 || ny == 0)
 		return;
@@ -395,7 +395,7 @@ grid_clear_lines(struct grid *gd, u_int py, u_int ny)
 	struct grid_line	*gl;
 	u_int			 yy;
 
- 	GRID_DEBUG(gd, "py=%u, ny=%u", py, ny);
+	GRID_DEBUG(gd, "py=%u, ny=%u", py, ny);
 
 	if (ny == 0)
 		return;
@@ -421,7 +421,7 @@ grid_move_lines(struct grid *gd, u_int dy, u_int py, u_int ny)
 {
 	u_int	yy;
 
- 	GRID_DEBUG(gd, "dy=%u, py=%u, ny=%u", dy, py, ny);
+	GRID_DEBUG(gd, "dy=%u, py=%u, ny=%u", dy, py, ny);
 
 	if (ny == 0 || py == dy)
 		return;
@@ -460,7 +460,7 @@ grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx)
 	struct grid_line	*gl;
 	u_int			 xx;
 
- 	GRID_DEBUG(gd, "dx=%u, px=%u, py=%u, nx=%u", dx, px, py, nx);
+	GRID_DEBUG(gd, "dx=%u, px=%u, py=%u, nx=%u", dx, px, py, nx);
 
 	if (nx == 0 || px == dx)
 		return;
@@ -499,8 +499,8 @@ grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx)
 char *
 grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx)
 {
- 	const struct grid_cell	*gc;
- 	const struct grid_utf8	*gu;
+	const struct grid_cell	*gc;
+	const struct grid_utf8	*gu;
 	char			*buf;
 	size_t			 len, off, size;
 	u_int			 xx;
@@ -535,14 +535,14 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx)
 			buf[off++] = gc->data;
 		}
 	}
-	
+
 	while (off > 0 && buf[off - 1] == ' ')
 		off--;
 	buf[off] = '\0';
 	return (buf);
 }
 
-/* 
+/*
  * Duplicate a set of lines between two grids. If there aren't enough lines in
  * either source or destination, the number of lines is limited to the number
  * available.
diff --git a/input-keys.c b/input-keys.c
index 84f71b71..27bb3778 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -1,4 +1,4 @@
-/* $Id: input-keys.c,v 1.43 2009-11-28 14:41:17 tcunha Exp $ */
+/* $Id: input-keys.c,v 1.44 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -81,7 +81,7 @@ struct input_key_ent input_keys[] = {
 	{ KEYC_DOWN|KEYC_CTRL,	"\033[B",	INPUTKEY_CURSOR },
 	{ KEYC_RIGHT|KEYC_CTRL,	"\033[C",	INPUTKEY_CURSOR },
 	{ KEYC_LEFT|KEYC_CTRL,	"\033[D",	INPUTKEY_CURSOR },
-	
+
 	{ KEYC_UP,		"\033OA",	INPUTKEY_CURSOR },
 	{ KEYC_DOWN,		"\033OB",	INPUTKEY_CURSOR },
 	{ KEYC_RIGHT,		"\033OC",	INPUTKEY_CURSOR },
@@ -122,7 +122,7 @@ struct input_key_ent input_keys[] = {
 	{ KEYC_KP_EIGHT,	"8",		0 },
 	{ KEYC_KP_NINE,		"9",		0 },
 	{ KEYC_KP_PLUS,		"+",		0 },
-	{ KEYC_KP_FOUR,		"4",		0 },	
+	{ KEYC_KP_FOUR,		"4",		0 },
 	{ KEYC_KP_FIVE,		"5",		0 },
 	{ KEYC_KP_SIX,		"6",		0 },
 	{ KEYC_KP_ONE,		"1",		0 },
@@ -157,7 +157,7 @@ input_key(struct window_pane *wp, int key)
 		return;
 	}
 
-	/* 
+	/*
 	 * Then try to look this up as an xterm key, if the flag to output them
 	 * is set.
 	 */
diff --git a/input.c b/input.c
index d356f721..71e0ba34 100644
--- a/input.c
+++ b/input.c
@@ -1,4 +1,4 @@
-/* $Id: input.c,v 1.103 2009-11-28 14:59:26 tcunha Exp $ */
+/* $Id: input.c,v 1.104 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -230,7 +230,7 @@ input_init(struct window_pane *wp)
 	ictx->string_len = 0;
 	ictx->string_buf = NULL;
 
- 	memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell);
+	memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell);
 
 	memcpy(&ictx->saved_cell, &grid_default_cell, sizeof ictx->saved_cell);
 	ictx->saved_cx = 0;
@@ -297,7 +297,7 @@ input_state_first(u_char ch, struct input_ctx *ictx)
 	}
 
 #if 0
-  	if (INPUT_C1CONTROL(ch)) {
+	if (INPUT_C1CONTROL(ch)) {
 		ch -= 0x40;
 		if (ch == '[')
 			input_state(ictx, input_state_sequence_first);
@@ -591,7 +591,7 @@ input_handle_character(u_char ch, struct input_ctx *ictx)
 
 	if (ch > 0x7f && options_get_number(&wp->window->options, "utf8")) {
 		if (utf8_open(&ictx->utf8data, ch)) {
-			log_debug2("-- utf8 size %zu: %zu: %hhu (%c)", 
+			log_debug2("-- utf8 size %zu: %zu: %hhu (%c)",
 			    ictx->utf8data.size, ictx->off, ch, ch);
 			input_state(ictx, input_state_utf8);
 			return;
@@ -945,7 +945,7 @@ input_handle_sequence_da(struct input_ctx *ictx)
 		return;
 	if (n != 0)
 		return;
-	
+
 	bufferevent_write(wp->event, "\033[?1;2c", (sizeof "\033[?1;2c") - 1);
 }
 
@@ -1164,7 +1164,7 @@ input_handle_sequence_sm(struct input_ctx *ictx)
 			log_debug("kcursor on");
 			break;
 		case 3:		/* DECCOLM */
-			screen_write_cursormove(&ictx->ctx, 0, 0);			
+			screen_write_cursormove(&ictx->ctx, 0, 0);
 			screen_write_clearscreen(&ictx->ctx);
 			break;
 		case 25:	/* TCEM */
@@ -1240,7 +1240,7 @@ input_handle_sequence_rm(struct input_ctx *ictx)
 			log_debug("kcursor off");
 			break;
 		case 3:		/* DECCOLM */
-			screen_write_cursormove(&ictx->ctx, 0, 0);			
+			screen_write_cursormove(&ictx->ctx, 0, 0);
 			screen_write_clearscreen(&ictx->ctx);
 			break;
 		case 25:	/* TCEM */
@@ -1257,7 +1257,7 @@ input_handle_sequence_rm(struct input_ctx *ictx)
 			sx = screen_size_x(s);
 			sy = screen_size_y(s);
 
-			/* 
+			/*
 			 * Exit alternative screen mode and restore the copied
 			 * grid.
 			 */
@@ -1284,7 +1284,7 @@ input_handle_sequence_rm(struct input_ctx *ictx)
 			 * Turn history back on (so resize can use it) and then
 			 * resize back to the current size.
 			 */
-  			wp->base.grid->flags |= GRID_HISTORY;
+			wp->base.grid->flags |= GRID_HISTORY;
 			if (sy > wp->saved_grid->sy)
 				screen_resize(s, sx, sy);
 
@@ -1372,7 +1372,7 @@ input_handle_sequence_sgr(struct input_ctx *ictx)
 	if (ARRAY_LENGTH(&ictx->args) == 0) {
 		attr = gc->attr;
 		memcpy(gc, &grid_default_cell, sizeof *gc);
- 		gc->attr |= (attr & GRID_ATTR_CHARSET);
+		gc->attr |= (attr & GRID_ATTR_CHARSET);
 		return;
 	}
 
diff --git a/job.c b/job.c
index 30bcb4df..b2fc9350 100644
--- a/job.c
+++ b/job.c
@@ -1,4 +1,4 @@
-/* $Id: job.c,v 1.13 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: job.c,v 1.14 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -79,7 +79,7 @@ job_add(struct jobs *jobs, int flags, struct client *c, const char *cmd,
     void (*callbackfn)(struct job *), void (*freefn)(void *), void *data)
 {
 	struct job	*job;
- 
+
 	job = xmalloc(sizeof *job);
 	job->cmd = xstrdup(cmd);
 	job->pid = -1;
@@ -182,7 +182,7 @@ job_run(struct job *job)
 
 		if (job->event != NULL)
 			bufferevent_free(job->event);
-		job->event = 
+		job->event =
 		    bufferevent_new(job->fd, NULL, NULL, job_callback, job);
 		bufferevent_enable(job->event, EV_READ);
 
@@ -215,7 +215,7 @@ job_died(struct job *job, int status)
 {
 	job->status = status;
 	job->pid = -1;
-	
+
 	if (job->fd == -1) {
 		if (job->callbackfn != NULL)
 			job->callbackfn(job);
diff --git a/key-bindings.c b/key-bindings.c
index eb36f5b4..1b9c0650 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -1,4 +1,4 @@
-/* $Id: key-bindings.c,v 1.85 2009-11-19 22:20:04 tcunha Exp $ */
+/* $Id: key-bindings.c,v 1.86 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -61,11 +61,11 @@ key_bindings_add(int key, int can_repeat, struct cmd_list *cmdlist)
 	struct key_binding	*bd;
 
 	key_bindings_remove(key);
-		    
+
 	bd = xmalloc(sizeof *bd);
 	bd->key = key;
 	SPLAY_INSERT(key_bindings, &key_bindings, bd);
-	
+
 	bd->can_repeat = can_repeat;
 	bd->cmdlist = cmdlist;
 }
@@ -104,9 +104,9 @@ key_bindings_init(void)
 	} table[] = {
 		{ ' ',			  0, &cmd_next_layout_entry },
 		{ '!', 			  0, &cmd_break_pane_entry },
-		{ '"', 			  0, &cmd_split_window_entry },	
+		{ '"', 			  0, &cmd_split_window_entry },
 		{ '#', 			  0, &cmd_list_buffers_entry },
-		{ '%', 			  0, &cmd_split_window_entry },	
+		{ '%', 			  0, &cmd_split_window_entry },
 		{ '&', 			  0, &cmd_confirm_before_entry },
 		{ ',', 			  0, &cmd_command_prompt_entry },
 		{ '-', 			  0, &cmd_delete_buffer_entry },
@@ -162,7 +162,7 @@ key_bindings_init(void)
 		{ KEYC_LEFT | KEYC_ESCAPE,  1, &cmd_resize_pane_entry },
 		{ KEYC_RIGHT | KEYC_ESCAPE, 1, &cmd_resize_pane_entry },
 		{ KEYC_UP | KEYC_CTRL,    1, &cmd_resize_pane_entry },
-		{ KEYC_DOWN | KEYC_CTRL,  1, &cmd_resize_pane_entry },	
+		{ KEYC_DOWN | KEYC_CTRL,  1, &cmd_resize_pane_entry },
 		{ KEYC_LEFT | KEYC_CTRL,  1, &cmd_resize_pane_entry },
 		{ KEYC_RIGHT | KEYC_CTRL, 1, &cmd_resize_pane_entry },
 	};
@@ -199,7 +199,7 @@ key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...)
 	va_end(ap);
 
 	*msg = toupper((u_char) *msg);
- 	status_message_set(ctx->curclient, "%s", msg);
+	status_message_set(ctx->curclient, "%s", msg);
 	xfree(msg);
 }
 
@@ -232,7 +232,7 @@ key_bindings_info(struct cmd_ctx *ctx, const char *fmt, ...)
 	va_end(ap);
 
 	*msg = toupper((u_char) *msg);
- 	status_message_set(ctx->curclient, "%s", msg);
+	status_message_set(ctx->curclient, "%s", msg);
 	xfree(msg);
 }
 
diff --git a/key-string.c b/key-string.c
index b94f3a39..4ee1d509 100644
--- a/key-string.c
+++ b/key-string.c
@@ -1,4 +1,4 @@
-/* $Id: key-string.c,v 1.27 2009-11-28 14:57:04 tcunha Exp $ */
+/* $Id: key-string.c,v 1.28 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -136,7 +136,7 @@ key_string_lookup_string(const char *string)
 			key = (u_char) ptr[0];
 		}
 
-		/* 
+		/*
 		 * Figure out if the single character in key is a valid ctrl
 		 * key.
 		 */
@@ -150,7 +150,7 @@ key_string_lookup_string(const char *string)
 			return (key - 96);
 		return (KEYC_NONE);
 	}
-	
+
 	if ((string[0] == 'M' || string[0] == 'm') && string[1] == '-') {
 		ptr = string + 2;
 		if (ptr[0] == '\0')
diff --git a/layout-set.c b/layout-set.c
index 7a1bff84..96231fb4 100644
--- a/layout-set.c
+++ b/layout-set.c
@@ -1,4 +1,4 @@
-/* $Id: layout-set.c,v 1.3 2009-07-28 23:04:29 tcunha Exp $ */
+/* $Id: layout-set.c,v 1.4 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -295,7 +295,7 @@ layout_set_main_h(struct window *w)
 			continue;
 		}
 
- 		/* Add in the columns. */
+		/* Add in the columns. */
 		layout_make_node(lcrow, LAYOUT_LEFTRIGHT);
 		for (i = 0; i < columns; i++) {
 			/* Create and add a pane cell. */
@@ -312,11 +312,11 @@ layout_set_main_h(struct window *w)
 		/* Adjust the row to fit the full width if necessary. */
 		if (i == columns)
 			i--;
- 		used = ((i + 1) * width) - 1;
- 		if (w->sx <= used)
- 			continue;
- 		lcchild = TAILQ_LAST(&lcrow->cells, layout_cells);
- 		layout_resize_adjust(lcchild, LAYOUT_LEFTRIGHT, w->sx - used);
+		used = ((i + 1) * width) - 1;
+		if (w->sx <= used)
+			continue;
+		lcchild = TAILQ_LAST(&lcrow->cells, layout_cells);
+		layout_resize_adjust(lcchild, LAYOUT_LEFTRIGHT, w->sx - used);
 	}
 
 	/* Adjust the last row height to fit if necessary. */
@@ -422,10 +422,10 @@ layout_set_main_v(struct window *w)
 		if (i == rows)
 			i--;
 		used = ((i + 1) * height) - 1;
- 		if (w->sy <= used)
- 			continue;
- 		lcchild = TAILQ_LAST(&lccolumn->cells, layout_cells);
- 		layout_resize_adjust(lcchild, LAYOUT_TOPBOTTOM, w->sy - used);
+		if (w->sy <= used)
+			continue;
+		lcchild = TAILQ_LAST(&lccolumn->cells, layout_cells);
+		layout_resize_adjust(lcchild, LAYOUT_TOPBOTTOM, w->sy - used);
 	}
 
 	/* Adjust the last column width to fit if necessary. */
diff --git a/layout.c b/layout.c
index 92953d03..e9f94077 100644
--- a/layout.c
+++ b/layout.c
@@ -1,4 +1,4 @@
-/* $Id: layout.c,v 1.16 2009-07-20 15:42:05 tcunha Exp $ */
+/* $Id: layout.c,v 1.17 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -45,13 +45,13 @@ layout_create_cell(struct layout_cell *lcparent)
 	lc->parent = lcparent;
 
 	TAILQ_INIT(&lc->cells);
-	
+
 	lc->sx = UINT_MAX;
 	lc->sy = UINT_MAX;
-	
+
 	lc->xoff = UINT_MAX;
 	lc->yoff = UINT_MAX;
-	
+
 	lc->wp = NULL;
 
 	return (lc);
@@ -201,8 +201,8 @@ layout_fix_panes(struct window *w, u_int wsx, u_int wsy)
 			if (sx < 1)
 				sx = lc->sx;
 		}
-		
-		/* 
+
+		/*
 		 * Similarly for the vertical size; the minimum vertical size
 		 * is two because scroll regions cannot be one line.
 		 */
@@ -231,7 +231,7 @@ layout_resize_check(struct layout_cell *lc, enum layout_type type)
 			available = lc->sx;
 		else
 			available = lc->sy;
-		
+
 		if (available > PANE_MINIMUM)
 			available -= PANE_MINIMUM;
 		else
@@ -269,7 +269,7 @@ layout_resize_adjust(struct layout_cell *lc, enum layout_type type, int change)
 		lc->sx += change;
 	else
 		lc->sy += change;
-	
+
 	/* If this is a leaf cell, that is all that is necessary. */
 	if (type == LAYOUT_WINDOWPANE)
 		return;
@@ -281,8 +281,8 @@ layout_resize_adjust(struct layout_cell *lc, enum layout_type type, int change)
 		return;
 	}
 
-	/* 
-	 * Child cell runs in the same direction. Adjust each child equally 
+	/*
+	 * Child cell runs in the same direction. Adjust each child equally
 	 * until no further change is possible.
 	 */
 	while (change != 0) {
@@ -327,10 +327,10 @@ layout_resize(struct window *w, u_int sx, u_int sy)
 	struct layout_cell	*lc = w->layout_root;
 	int			 xlimit, ylimit, xchange, ychange;
 
-	/* 
+	/*
 	 * Adjust horizontally. Do not attempt to reduce the layout lower than
 	 * the minimum (more than the amount returned by layout_resize_check).
-	 * 
+	 *
 	 * This can mean that the window size is smaller than the total layout
 	 * size: redrawing this is handled at a higher level, but it does leave
 	 * a problem with growing the window size here: if the current size is
@@ -366,7 +366,7 @@ layout_resize(struct window *w, u_int sx, u_int sy)
 	}
 	if (ychange != 0)
 		layout_resize_adjust(lc, LAYOUT_TOPBOTTOM, ychange);
-	
+
 	/* Fix cell offsets. */
 	layout_fix_offsets(lc);
 	layout_fix_panes(w, sx, sy);
@@ -408,7 +408,7 @@ layout_resize_pane(struct window_pane *wp, enum layout_type type, int change)
 		if (size == 0)	/* no more change possible */
 			break;
 	}
-	
+
 	/* Fix cell offsets. */
 	layout_fix_offsets(wp->window->layout_root);
 	layout_fix_panes(wp->window, wp->window->sx, wp->window->sy);
@@ -423,14 +423,14 @@ layout_resize_pane_grow(
 
 	/* Growing. Always add to the current cell. */
 	lcadd = lc;
-			
+
 	/* Look towards the tail for a suitable cell for reduction. */
 	lcremove = TAILQ_NEXT(lc, entry);
 	while (lcremove != NULL) {
 		size = layout_resize_check(lcremove, type);
 		if (size > 0)
 			break;
-		lcremove = TAILQ_NEXT(lcremove, entry);	
+		lcremove = TAILQ_NEXT(lcremove, entry);
 	}
 
 	/* If none found, look towards the head. */
@@ -514,7 +514,7 @@ layout_split_pane(struct window_pane *wp,
 	default:
 		fatalx("bad layout type");
 	}
-	
+
 	if (lc->parent != NULL && lc->parent->type == type) {
 		/*
 		 * If the parent exists and is of the same type as the split,
@@ -528,7 +528,7 @@ layout_split_pane(struct window_pane *wp,
 		/*
 		 * Otherwise create a new parent and insert it.
 		 */
-		
+
 		/* Create and insert the replacement parent. */
 		lcparent = layout_create_cell(lc->parent);
 		layout_make_node(lcparent, type);
@@ -537,11 +537,11 @@ layout_split_pane(struct window_pane *wp,
 			wp->window->layout_root = lcparent;
 		else
 			TAILQ_REPLACE(&lc->parent->cells, lc, lcparent, entry);
-		
+
 		/* Insert the old cell. */
 		lc->parent = lcparent;
 		TAILQ_INSERT_HEAD(&lcparent->cells, lc, entry);
-		
+
 		/* Create the new child cell. */
 		lcnew = layout_create_cell(lcparent);
 		TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry);
@@ -554,7 +554,7 @@ layout_split_pane(struct window_pane *wp,
 	case LAYOUT_LEFTRIGHT:
 		if (size < 0)
 			size2 = ((sx + 1) / 2) - 1;
- 		else
+		else
 			size2 = size;
 		if (size2 < PANE_MINIMUM)
 			size2 = PANE_MINIMUM;
@@ -600,7 +600,7 @@ layout_close_pane(struct window_pane *wp)
 	lc = wp->layout_cell;
 	lcparent = lc->parent;
 
-	/* 
+	/*
 	 * If no parent, this is the last pane so window close is imminent and
 	 * there is no need to resize anything.
 	 */
@@ -623,8 +623,8 @@ layout_close_pane(struct window_pane *wp)
 	/* Remove this from the parent's list. */
 	TAILQ_REMOVE(&lcparent->cells, lc, entry);
 	layout_free_cell(lc);
-	
-	/* 
+
+	/*
 	 * If the parent now has one cell, remove the parent from the tree and
 	 * replace it by that cell.
 	 */
diff --git a/log.c b/log.c
index 823d00e6..78f525ba 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
-/* $Id: log.c,v 1.16 2009-07-22 17:31:20 tcunha Exp $ */
+/* $Id: log.c,v 1.17 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -183,7 +183,7 @@ log_vfatal(const char *msg, va_list ap)
 		log_vwrite(LOG_CRIT, fmt, ap);
 	} else {
 		if (asprintf(&fmt, "fatal: %s", msg) == -1)
-       			exit(1);
+			exit(1);
 		log_vwrite(LOG_CRIT, fmt, ap);
 	}
 	free(fmt);
diff --git a/mode-key.c b/mode-key.c
index 244137d0..73da4502 100644
--- a/mode-key.c
+++ b/mode-key.c
@@ -1,4 +1,4 @@
-/* $Id: mode-key.c,v 1.35 2009-11-13 16:58:24 tcunha Exp $ */
+/* $Id: mode-key.c,v 1.36 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -42,7 +42,7 @@
 /* Edit keys command strings. */
 struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
 	{ MODEKEYEDIT_BACKSPACE, "backspace" },
- 	{ MODEKEYEDIT_CANCEL, "cancel" },
+	{ MODEKEYEDIT_CANCEL, "cancel" },
 	{ MODEKEYEDIT_COMPLETE, "complete" },
 	{ MODEKEYEDIT_CURSORLEFT, "cursor-left" },
 	{ MODEKEYEDIT_CURSORRIGHT, "cursor-right" },
@@ -61,7 +61,7 @@ struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
 
 	{ 0, NULL }
 };
-	
+
 /* Choice keys command strings. */
 struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
 	{ MODEKEYCHOICE_CANCEL, "cancel" },
@@ -195,14 +195,14 @@ const struct mode_key_entry mode_key_vi_copy[] = {
 	{ KEYC_RIGHT,		0, MODEKEYCOPY_RIGHT },
 	{ KEYC_UP | KEYC_CTRL,	0, MODEKEYCOPY_SCROLLUP },
 	{ KEYC_UP,		0, MODEKEYCOPY_UP },
-	
+
 	{ 0,			-1, 0 }
 };
 struct mode_key_tree mode_key_tree_vi_copy;
 
 /* emacs editing keys. */
 const struct mode_key_entry mode_key_emacs_edit[] = {
-	{ '\001' /* C-a */,	0, MODEKEYEDIT_STARTOFLINE }, 
+	{ '\001' /* C-a */,	0, MODEKEYEDIT_STARTOFLINE },
 	{ '\002' /* C-b */,	0, MODEKEYEDIT_CURSORLEFT },
 	{ '\003' /* C-c */,	0, MODEKEYEDIT_CANCEL },
 	{ '\004' /* C-d */,	0, MODEKEYEDIT_DELETE },
@@ -218,7 +218,7 @@ const struct mode_key_entry mode_key_emacs_edit[] = {
 	{ '\031' /* C-y */,	0, MODEKEYEDIT_PASTE },
 	{ '\033' /* Escape */,	0, MODEKEYEDIT_CANCEL },
 	{ '\r',			0, MODEKEYEDIT_ENTER },
-	{ 'm' | KEYC_ESCAPE,	0, MODEKEYEDIT_STARTOFLINE }, 
+	{ 'm' | KEYC_ESCAPE,	0, MODEKEYEDIT_STARTOFLINE },
 	{ KEYC_BSPACE,		0, MODEKEYEDIT_BACKSPACE },
 	{ KEYC_DC,		0, MODEKEYEDIT_DELETE },
 	{ KEYC_DOWN,		0, MODEKEYEDIT_HISTORYDOWN },
@@ -287,7 +287,7 @@ const struct mode_key_entry mode_key_emacs_copy[] = {
 	{ KEYC_UP | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEUP },
 	{ KEYC_UP,		0, MODEKEYCOPY_UP },
 
-	{ 0,			-1, 0 }	
+	{ 0,			-1, 0 }
 };
 struct mode_key_tree mode_key_tree_emacs_copy;
 
@@ -343,7 +343,7 @@ const struct mode_key_table *
 mode_key_findtable(const char *name)
 {
 	const struct mode_key_table	*mtab;
-		
+
 	for (mtab = mode_key_tables; mtab->name != NULL; mtab++) {
 		if (strcasecmp(name, mtab->name) == 0)
 			return (mtab);
diff --git a/names.c b/names.c
index 002dfef6..d4d128c9 100644
--- a/names.c
+++ b/names.c
@@ -1,4 +1,4 @@
-/* $Id: names.c,v 1.20 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: names.c,v 1.21 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -59,7 +59,7 @@ window_name_callback(unused int fd, unused short events, void *data)
 	if (name == NULL)
 		wname = default_window_name(w);
 	else {
-		/* 
+		/*
 		 * If tmux is using the default command, it will be a login
 		 * shell and argv[0] may have a - prefix. Remove this if it is
 		 * present. Ick.
@@ -71,13 +71,13 @@ window_name_callback(unused int fd, unused short events, void *data)
 				wname = parse_window_name(name);
 		xfree(name);
 	}
-	
+
 	if (w->active->fd == -1) {
 		xasprintf(&name, "%s[dead]", wname);
 		xfree(wname);
 		wname = name;
 	}
-	
+
 	if (strcmp(wname, w->name) == 0)
 		xfree(wname);
 	else {
diff --git a/paste.c b/paste.c
index ec9eefb3..2ff4133e 100644
--- a/paste.c
+++ b/paste.c
@@ -1,4 +1,4 @@
-/* $Id: paste.c,v 1.12 2009-11-28 14:54:12 tcunha Exp $ */
+/* $Id: paste.c,v 1.13 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -106,7 +106,7 @@ paste_free_index(struct paste_stack *ps, u_int idx)
 	return (0);
 }
 
-/* 
+/*
  * Add an item onto the top of the stack, freeing the bottom if at limit. Note
  * that the caller is responsible for allocating data.
  */
@@ -133,7 +133,7 @@ paste_add(struct paste_stack *ps, char *data, size_t size, u_int limit)
 }
 
 
-/* 
+/*
  * Replace an item on the stack. Note that the caller is responsible for
  * allocating data.
  */
diff --git a/screen-redraw.c b/screen-redraw.c
index 8005dc38..ba694ff8 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -1,4 +1,4 @@
-/* $Id: screen-redraw.c,v 1.49 2009-10-28 23:17:28 tcunha Exp $ */
+/* $Id: screen-redraw.c,v 1.50 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -67,7 +67,7 @@ screen_redraw_cell_border(struct client *c, u_int px, u_int py)
 		}
 
 		/* Top/bottom borders. */
-		if ((wp->xoff == 0 || px >= wp->xoff - 1) && 
+		if ((wp->xoff == 0 || px >= wp->xoff - 1) &&
 		    px <= wp->xoff + wp->sx) {
 			if (wp->yoff != 0 && py == wp->yoff - 1)
 				return (1);
@@ -105,7 +105,7 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py)
 		if (!screen_redraw_cell_border(c, px, py))
 			return (CELL_INSIDE);
 
-		/* 
+		/*
 		 * Construct a bitmask of whether the cells to the left (bit
 		 * 4), right, top, and bottom (bit 1) of this cell are borders.
 		 */
@@ -119,7 +119,7 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py)
 		if (py <= w->sy && screen_redraw_cell_border(c, px, py + 1))
 			borders |= 1;
 
-		/* 
+		/*
 		 * Figure out what kind of border this cell is. Only one bit
 		 * set doesn't make sense (can't have a border cell with no
 		 * others connected).
@@ -263,7 +263,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 		tty_puts(tty, buf);
 		return;
 	}
-	
+
 	px -= len * 3;
 	py -= 2;
 
@@ -275,7 +275,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
 		if (*ptr < '0' || *ptr > '9')
 			continue;
 		idx = *ptr - '0';
-		
+
 		for (j = 0; j < 5; j++) {
 			for (i = px; i < px + 5; i++) {
 				tty_cursor(tty, xoff + i, yoff + py + j);
diff --git a/screen-write.c b/screen-write.c
index b7360059..016127b7 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1,4 +1,4 @@
-/* $Id: screen-write.c,v 1.87 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: screen-write.c,v 1.88 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -183,7 +183,7 @@ screen_write_vnputs(struct screen_write_ctx *ctx, ssize_t maxlen,
 				break;
 			}
 			size += utf8data.width;
-			
+
 			gc->flags |= GRID_FLAG_UTF8;
 			screen_write_cell(ctx, gc, &utf8data);
 			gc->flags &= ~GRID_FLAG_UTF8;
@@ -376,7 +376,7 @@ screen_write_copy(struct screen_write_ctx *ctx,
 				bx = gl->cellsize;
 			else
 				bx = px + nx;
-			
+
 			for (xx = ax; xx < bx; xx++) {
 				if (xx >= gl->cellsize)
 					gc = &grid_default_cell;
@@ -646,7 +646,7 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny)
 		ny = s->rlower + 1 - s->cy;
 	if (ny == 0)
 		return;
-	
+
 	screen_write_initctx(ctx, &ttyctx, 0);
 
 	if (s->cy < s->rupper || s->cy > s->rlower)
@@ -682,7 +682,7 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny)
 		tty_write(tty_cmd_deleteline, &ttyctx);
 		return;
 	}
-	
+
 	if (ny > s->rlower + 1 - s->cy)
 		ny = s->rlower + 1 - s->cy;
 	if (ny == 0)
@@ -728,7 +728,7 @@ screen_write_clearendofline(struct screen_write_ctx *ctx)
 	if (s->cx <= sx - 1)
 		grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1);
 
- 	tty_write(tty_cmd_clearendofline, &ttyctx);
+	tty_write(tty_cmd_clearendofline, &ttyctx);
 }
 
 /* Clear to start of line from cursor. */
@@ -863,7 +863,7 @@ screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped)
 		s->cy++;
 
 	ttyctx.num = wrapped;
- 	tty_write(tty_cmd_linefeed, &ttyctx);
+	tty_write(tty_cmd_linefeed, &ttyctx);
 }
 
 /* Carriage return (cursor to start of line). */
@@ -988,7 +988,7 @@ screen_write_cell(struct screen_write_ctx *ctx,
 
 	/*
 	 * If the width is zero, combine onto the previous character, if
-	 * there is space. 
+	 * there is space.
 	 */
 	if (width == 0) {
 		if (screen_write_combine(ctx, utf8data) == 0) {
diff --git a/screen.c b/screen.c
index 1b149a4b..58776548 100644
--- a/screen.c
+++ b/screen.c
@@ -1,4 +1,4 @@
-/* $Id: screen.c,v 1.96 2009-08-09 17:28:23 tcunha Exp $ */
+/* $Id: screen.c,v 1.97 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -50,7 +50,7 @@ screen_reinit(struct screen *s)
 	s->rlower = screen_size_y(s) - 1;
 
 	s->mode = MODE_CURSOR;
-	
+
 	screen_reset_tabs(s);
 
 	grid_clear_lines(s->grid, s->grid->hsize, s->grid->sy);
@@ -151,12 +151,12 @@ screen_resize_y(struct screen *s, u_int sy)
 		fatalx("zero size");
 	oldy = screen_size_y(s);
 
-	/* 
+	/*
 	 * When resizing:
 	 *
 	 * If the height is decreasing, delete lines from the bottom until
 	 * hitting the cursor, then push lines from the top into the history.
-	 * 
+	 *
 	 * When increasing, pull as many lines as possible from the history to
 	 * the top, then fill the remaining with blanks at the bottom.
 	 */
@@ -190,7 +190,7 @@ screen_resize_y(struct screen *s, u_int sy)
 			grid_view_delete_lines(gd, 0, available);
 		}
 		s->cy -= needed;
- 	}
+	}
 
 	/* Resize line arrays. */
 	gd->linedata = xrealloc(
diff --git a/server-client.c b/server-client.c
index 9bde7175..fcfebb35 100644
--- a/server-client.c
+++ b/server-client.c
@@ -1,4 +1,4 @@
-/* $Id: server-client.c,v 1.25 2009-11-28 14:50:36 tcunha Exp $ */
+/* $Id: server-client.c,v 1.26 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -35,7 +35,7 @@ void	server_client_reset_state(struct client *);
 int	server_client_msg_dispatch(struct client *);
 void	server_client_msg_command(struct client *, struct msg_command_data *);
 void	server_client_msg_identify(
-    	    struct client *, struct msg_identify_data *, int);
+	    struct client *, struct msg_identify_data *, int);
 void	server_client_msg_shell(struct client *);
 
 void printflike2 server_client_msg_error(struct cmd_ctx *, const char *, ...);
@@ -61,7 +61,7 @@ server_client_create(int fd)
 	c->references = 0;
 	imsg_init(&c->ibuf, fd);
 	server_update_event(c);
-	
+
 	if (gettimeofday(&c->creation_time, NULL) != 0)
 		fatal("gettimeofday failed");
 	memcpy(&c->activity_time, &c->creation_time, sizeof c->activity_time);
@@ -188,7 +188,7 @@ server_client_callback(int fd, short events, void *data)
 			goto client_lost;
 	}
 
-	server_update_event(c);	
+	server_update_event(c);
 	return;
 
 client_lost:
@@ -269,7 +269,7 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
 	oo = &c->session->options;
 
 	/* Special case: number keys jump to pane in identify mode. */
-	if (c->flags & CLIENT_IDENTIFY && key >= '0' && key <= '9') {	
+	if (c->flags & CLIENT_IDENTIFY && key >= '0' && key <= '9') {
 		wp = window_pane_at_index(w, key - '0');
 		if (wp != NULL && window_pane_visible(wp))
 			window_set_active_pane(w, wp);
@@ -347,7 +347,7 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
 	xtimeout = options_get_number(&c->session->options, "repeat-time");
 	if (xtimeout != 0 && bd->can_repeat) {
 		c->flags |= CLIENT_PREFIX|CLIENT_REPEAT;
-		
+
 		tv.tv_sec = xtimeout / 1000;
 		tv.tv_usec = (xtimeout % 1000) * 1000L;
 		evtimer_del(&c->repeat_timer);
@@ -488,7 +488,7 @@ server_client_set_title(struct client *c)
 	char		*title;
 
 	template = options_get_string(&s->options, "set-titles-string");
-	
+
 	title = status_replace(c, NULL, template, time(NULL), 1);
 	if (c->title == NULL || strcmp(title, c->title) != 0) {
 		if (c->title != NULL)
@@ -742,14 +742,14 @@ server_client_msg_shell(struct client *c)
 {
 	struct msg_shell_data	 data;
 	const char		*shell;
-	
+
 	shell = options_get_string(&global_s_options, "default-shell");
 
 	if (*shell == '\0' || areshell(shell))
 		shell = _PATH_BSHELL;
 	if (strlcpy(data.shell, shell, sizeof data.shell) >= sizeof data.shell)
 		strlcpy(data.shell, _PATH_BSHELL, sizeof data.shell);
-	
+
 	server_write_client(c, MSG_SHELL, &data, sizeof data);
 	c->flags |= CLIENT_BAD;	/* it will die after exec */
 }
diff --git a/server-fn.c b/server-fn.c
index 0aac5bf4..ab8f03ec 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -1,4 +1,4 @@
-/* $Id: server-fn.c,v 1.98 2009-11-28 14:50:37 tcunha Exp $ */
+/* $Id: server-fn.c,v 1.99 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -61,7 +61,7 @@ server_write_client(
 		return;
 	log_debug("writing %d to client %d", type, c->ibuf.fd);
 	imsg_compose(ibuf, type, PROTOCOL_VERSION, -1, -1, (void *) buf, len);
-	server_update_event(c);	
+	server_update_event(c);
 }
 
 void
@@ -208,7 +208,7 @@ server_lock_session(struct session *s)
 		if (c == NULL || c->session == NULL || c->session != s)
 			continue;
 		server_lock_client(c);
-	}	
+	}
 }
 
 void
@@ -225,7 +225,7 @@ server_lock_client(struct client *c)
 	cmdlen = strlcpy(lockdata.cmd, cmd, sizeof lockdata.cmd);
 	if (cmdlen >= sizeof lockdata.cmd)
 		return;
-      
+
 	tty_stop_tty(&c->tty);
 	tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_SMCUP));
 	tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_CLEAR));
@@ -240,14 +240,14 @@ server_kill_window(struct window *w)
 	struct session	*s;
 	struct winlink	*wl;
 	u_int		 i;
-	
+
 	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
 		s = ARRAY_ITEM(&sessions, i);
 		if (s == NULL || !session_has(s, w))
 			continue;
 		if ((wl = winlink_find_by_window(&s->windows, w)) == NULL)
 			continue;
-		
+
 		if (session_detach(s, wl))
 			server_destroy_session_group(s);
 		else {
@@ -357,7 +357,7 @@ server_destroy_session(struct session *s)
 {
 	struct client	*c;
 	u_int		 i;
-	
+
 	for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
 		c = ARRAY_ITEM(&clients, i);
 		if (c == NULL || c->session != s)
@@ -376,7 +376,7 @@ server_set_identify(struct client *c)
 	delay = options_get_number(&c->session->options, "display-panes-time");
 	tv.tv_sec = delay / 1000;
 	tv.tv_usec = (delay % 1000) * 1000L;
-	
+
 	evtimer_del(&c->identify_timer);
 	evtimer_set(&c->identify_timer, server_callback_identify, c);
 	evtimer_add(&c->identify_timer, &tv);
@@ -417,5 +417,5 @@ server_update_event(struct client *c)
 		events |= EV_WRITE;
 	event_del(&c->event);
 	event_set(&c->event, c->ibuf.fd, events, server_client_callback, c);
-	event_add(&c->event, NULL);	
+	event_add(&c->event, NULL);
 }
diff --git a/server-window.c b/server-window.c
index be863922..88002a3a 100644
--- a/server-window.c
+++ b/server-window.c
@@ -1,4 +1,4 @@
-/* $Id: server-window.c,v 1.12 2009-11-14 17:48:39 tcunha Exp $ */
+/* $Id: server-window.c,v 1.13 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -81,7 +81,7 @@ server_window_loop(void)
 			s = ARRAY_ITEM(&sessions, j);
 			if (s == NULL || !session_has(s, w))
 				continue;
-			
+
 			if (server_window_check_bell(s, w) ||
 			    server_window_check_activity(s, w))
 				server_status_session(s);
@@ -121,7 +121,7 @@ server_window_check_bell(struct session *s, struct window *w)
 				tty_putcode(&c->tty, TTYC_BEL);
 				continue;
 			}
- 			if (c->session->curw->window == w) {
+			if (c->session->curw->window == w) {
 				status_message_set(c, "Bell in current window");
 				continue;
 			}
@@ -137,7 +137,7 @@ server_window_check_bell(struct session *s, struct window *w)
 			c = ARRAY_ITEM(&clients, i);
 			if (c == NULL || c->session != s)
 				continue;
- 			if (c->session->curw->window != w)
+			if (c->session->curw->window != w)
 				continue;
 			if (!visual) {
 				tty_putcode(&c->tty, TTYC_BEL);
@@ -163,7 +163,7 @@ server_window_check_activity(struct session *s, struct window *w)
 	if (s->curw->window == w)
 		return (0);
 
- 	if (!options_get_number(&w->options, "monitor-activity"))
+	if (!options_get_number(&w->options, "monitor-activity"))
 		return (0);
 
 	if (session_alert_has_window(s, w, WINDOW_ACTIVITY))
@@ -172,7 +172,7 @@ server_window_check_activity(struct session *s, struct window *w)
 
 	if (s->flags & SESSION_UNATTACHED)
 		return (0);
- 	if (options_get_number(&s->options, "visual-activity")) {
+	if (options_get_number(&s->options, "visual-activity")) {
 		for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
 			c = ARRAY_ITEM(&clients, i);
 			if (c == NULL || c->session != s)
@@ -193,7 +193,7 @@ server_window_check_content(
 	struct client	*c;
 	u_int		 i;
 	char		*found, *ptr;
-	
+
 	if (!(w->flags & WINDOW_ACTIVITY))	/* activity for new content */
 		return (0);
 	if (s->curw->window == w)
@@ -208,12 +208,12 @@ server_window_check_content(
 
 	if ((found = window_pane_search(wp, ptr, NULL)) == NULL)
 		return (0);
-    	xfree(found);
+	xfree(found);
 
 	session_alert_add(s, w, WINDOW_CONTENT);
 	if (s->flags & SESSION_UNATTACHED)
 		return (0);
- 	if (options_get_number(&s->options, "visual-content")) {
+	if (options_get_number(&s->options, "visual-content")) {
 		for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
 			c = ARRAY_ITEM(&clients, i);
 			if (c == NULL || c->session != s)
diff --git a/server.c b/server.c
index 130cb0ee..9dc00b96 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.231 2009-12-04 22:04:55 tcunha Exp $ */
+/* $Id: server.c,v 1.232 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -234,7 +234,7 @@ server_loop(void)
 
 		key_bindings_clean();
 		server_clean_dead();
-	} 
+	}
 }
 
 /* Check if the server should be shutting down (no more clients or windows). */
@@ -472,7 +472,7 @@ server_child_exited(pid_t pid, int status)
 				break;
 			}
 		}
-	}		
+	}
 
 	SLIST_FOREACH(job, &all_jobs, lentry) {
 		if (pid == job->pid) {
@@ -572,7 +572,7 @@ server_lock_server(void)
 void
 server_lock_sessions(void)
 {
-        struct session  *s;
+	struct session  *s;
 	u_int		 i;
 	int		 timeout;
 	time_t		 t;
diff --git a/session.c b/session.c
index 7d2f929f..625a82d6 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $Id: session.c,v 1.72 2009-11-28 14:50:37 tcunha Exp $ */
+/* $Id: session.c,v 1.73 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -164,7 +164,7 @@ session_create(const char *name, const char *cmd, const char *cwd,
 		s->name = xstrdup(name);
 	else
 		xasprintf(&s->name, "%u", i);
-	
+
 	if (cmd != NULL) {
 		if (session_new(s, NULL, cmd, cwd, idx, cause) == NULL) {
 			session_destroy(s);
@@ -207,7 +207,7 @@ session_destroy(struct session *s)
 		winlink_remove(&s->windows, RB_ROOT(&s->windows));
 
 	xfree(s->name);
-	
+
 	for (i = 0; i < ARRAY_LENGTH(&dead_sessions); i++) {
 		if (ARRAY_ITEM(&dead_sessions, i) == NULL) {
 			ARRAY_SET(&dead_sessions, i, s);
@@ -232,7 +232,7 @@ session_index(struct session *s, u_int *i)
 
 /* Create a new window on a session. */
 struct winlink *
-session_new(struct session *s, 
+session_new(struct session *s,
     const char *name, const char *cmd, const char *cwd, int idx, char **cause)
 {
 	struct window	*w;
@@ -462,7 +462,7 @@ session_group_index(struct session_group *sg)
 
 /*
  * Add a session to the session group containing target, creating it if
- * necessary. 
+ * necessary.
  */
 void
 session_group_add(struct session *target, struct session *s)
diff --git a/status.c b/status.c
index 6cabc7c2..e1dcd403 100644
--- a/status.c
+++ b/status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c,v 1.139 2009-12-04 22:11:23 tcunha Exp $ */
+/* $Id: status.c,v 1.140 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -37,9 +37,9 @@ char   *status_job(struct client *, char **);
 void	status_job_callback(struct job *);
 size_t	status_width(struct client *, struct winlink *, time_t);
 char   *status_print(
-    	    struct client *, struct winlink *, time_t, struct grid_cell *);
+	    struct client *, struct winlink *, time_t, struct grid_cell *);
 void	status_replace1(struct client *,
-    	    struct winlink *, char **, char **, char *, size_t, int);
+	    struct winlink *, char **, char **, char *, size_t, int);
 void	status_message_callback(int, short, void *);
 
 void	status_prompt_add_history(struct client *);
@@ -163,7 +163,7 @@ status_redraw(struct client *c)
 	 * Figure out how much space we have for the window list. If there
 	 * isn't enough space, just show a blank status line.
 	 */
-        needed = 0;
+	needed = 0;
 	if (llen != 0)
 		needed += llen + 1;
 	if (rlen != 0)
@@ -179,7 +179,7 @@ status_redraw(struct client *c)
 			xfree(wl->status_text);
 		memcpy(&wl->status_cell, &stdgc, sizeof wl->status_cell);
 		wl->status_text = status_print(c, wl, t, &wl->status_cell);
-		wl->status_width = 
+		wl->status_width =
 		    screen_write_cstrlen(utf8flag, "%s", wl->status_text);
 
 		if (wl == s->curw)
@@ -193,7 +193,7 @@ status_redraw(struct client *c)
 	/* And draw the window list into it. */
 	screen_write_start(&ctx, NULL, &window_list);
 	RB_FOREACH(wl, winlinks, &s->windows) {
- 		screen_write_cnputs(&ctx,
+		screen_write_cnputs(&ctx,
 		    -1, &wl->status_cell, utf8flag, "%s", wl->status_text);
 		screen_write_putc(&ctx, &stdgc, ' ');
 	}
@@ -227,7 +227,7 @@ status_redraw(struct client *c)
 			larrow = 1;
 			wlavailable--;
 		}
-		
+
 		wlstart = wloffset + wlsize - wlavailable;
 		if (wlavailable > 0 && wlwidth > wlstart + wlavailable + 1) {
 			rarrow = 1;
@@ -271,7 +271,7 @@ status_redraw(struct client *c)
 	}
 
 draw:
- 	/* Begin drawing. */
+	/* Begin drawing. */
 	screen_write_start(&ctx, NULL, &c->status);
 
 	/* Draw the left string and arrow. */
@@ -320,7 +320,7 @@ draw:
 	/* Copy the window list. */
 	screen_write_cursormove(&ctx, wloffset, 0);
 	screen_write_copy(&ctx, &window_list, wlstart, 0, wlwidth, 1);
- 	screen_free(&window_list);
+	screen_free(&window_list);
 
 	screen_write_stop(&ctx);
 
@@ -355,7 +355,7 @@ status_replace1(struct client *c,struct winlink *wl,
 	limit = strtol(*iptr, &endptr, 10);
 	if ((limit == 0 && errno != EINVAL) ||
 	    (limit == LONG_MIN && errno != ERANGE) ||
-	    (limit == LONG_MAX && errno != ERANGE) || 
+	    (limit == LONG_MAX && errno != ERANGE) ||
 	    limit != 0)
 		*iptr = endptr;
 	if (limit <= 0)
@@ -412,7 +412,7 @@ status_replace1(struct client *c,struct winlink *wl,
 		ptr = tmp;
 		goto do_replace;
 	case '[':
-		/* 
+		/*
 		 * Embedded style, handled at display time. Leave present and
 		 * skip input until ].
 		 */
@@ -424,7 +424,7 @@ status_replace1(struct client *c,struct winlink *wl,
 	}
 
 	return;
-	
+
 do_replace:
 	ptrlen = strlen(ptr);
 	if ((size_t) limit < ptrlen)
@@ -779,7 +779,7 @@ status_prompt_set(struct client *c, const char *msg,
 void
 status_prompt_clear(struct client *c)
 {
- 	if (c->prompt_string == NULL)
+	if (c->prompt_string == NULL)
 		return;
 
 	if (c->prompt_freefn != NULL && c->prompt_data != NULL)
@@ -857,8 +857,8 @@ status_prompt_redraw(struct client *c)
 		screen_write_nputs(
 		    &ctx, left, &gc, utf8flag, "%s", c->prompt_buffer + off);
 
- 		for (i = len + size; i < c->tty.sx; i++)
- 			screen_write_putc(&ctx, &gc, ' ');
+		for (i = len + size; i < c->tty.sx; i++)
+			screen_write_putc(&ctx, &gc, ' ');
 	}
 
 	screen_write_stop(&ctx);
@@ -949,12 +949,12 @@ status_prompt_key(struct client *c, int key)
 		size -= last - first;
 
 		/* Insert the new word. */
- 		size += strlen(s);
+		size += strlen(s);
 		off = first - c->prompt_buffer;
- 		c->prompt_buffer = xrealloc(c->prompt_buffer, 1, size + 1);
+		c->prompt_buffer = xrealloc(c->prompt_buffer, 1, size + 1);
 		first = c->prompt_buffer + off;
- 		memmove(first + strlen(s), first, n);
- 		memcpy(first, s, strlen(s));
+		memmove(first + strlen(s), first, n);
+		memcpy(first, s, strlen(s));
 
 		c->prompt_index = (first - c->prompt_buffer) + strlen(s);
 		xfree(s);
@@ -974,7 +974,7 @@ status_prompt_key(struct client *c, int key)
 			c->flags |= CLIENT_STATUS;
 		}
 		break;
- 	case MODEKEYEDIT_DELETE:
+	case MODEKEYEDIT_DELETE:
 		if (c->prompt_index != size) {
 			memmove(c->prompt_buffer + c->prompt_index,
 			    c->prompt_buffer + c->prompt_index + 1,
@@ -1056,7 +1056,7 @@ status_prompt_key(struct client *c, int key)
 			c->flags |= CLIENT_STATUS;
 		}
 		break;
- 	case MODEKEYEDIT_ENTER:
+	case MODEKEYEDIT_ENTER:
 		if (*c->prompt_buffer != '\0')
 			status_prompt_add_history(c);
 		if (c->prompt_callbackfn(c->prompt_data, c->prompt_buffer) == 0)
diff --git a/tmux.1 b/tmux.1
index 7e210776..ac50c6cf 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1,4 +1,4 @@
-.\" $Id: tmux.1,v 1.211 2009-12-04 22:11:23 tcunha Exp $
+.\" $Id: tmux.1,v 1.212 2009-12-04 22:14:47 tcunha Exp $
 .\"
 .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 .\"
@@ -1252,7 +1252,7 @@ options - it is not possible to unset a global option.
 With
 .Fl w ,
 this command is equivalent to
-.Ic set-window-option 
+.Ic set-window-option
 with
 .Ar target-window .
 .Pp
@@ -1850,7 +1850,7 @@ or the global session options with
 If
 .Fl w
 is used, this command is equivalent to
-.Ic show-window-options 
+.Ic show-window-options
 with
 .Ar target-window .
 .It Xo Ic show-window-options
diff --git a/tmux.c b/tmux.c
index ae58f676..02489428 100644
--- a/tmux.c
+++ b/tmux.c
@@ -1,4 +1,4 @@
-/* $Id: tmux.c,v 1.192 2009-11-28 14:50:37 tcunha Exp $ */
+/* $Id: tmux.c,v 1.193 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -222,7 +222,7 @@ int
 main(int argc, char **argv)
 {
 	struct cmd_list		*cmdlist;
- 	struct cmd		*cmd;
+	struct cmd		*cmd;
 	enum msgtype		 msg;
 	struct passwd		*pw;
 	struct options		*so, *wo;
@@ -314,7 +314,7 @@ main(int argc, char **argv)
 	}
 
 	environ_init(&global_environ);
- 	for (var = environ; *var != NULL; var++)
+	for (var = environ; *var != NULL; var++)
 		environ_put(&global_environ, *var);
 
 	options_init(&global_s_options, NULL);
@@ -397,10 +397,10 @@ main(int argc, char **argv)
 	options_set_string(wo, "window-status-format", "#I:#W#F");
 	options_set_string(wo, "window-status-current-format", "#I:#W#F");
 	options_set_number(wo, "xterm-keys", 0);
- 	options_set_number(wo, "remain-on-exit", 0);
+	options_set_number(wo, "remain-on-exit", 0);
 	options_set_number(wo, "synchronize-panes", 0);
 
- 	if (flags & IDENTIFY_UTF8) {
+	if (flags & IDENTIFY_UTF8) {
 		options_set_number(so, "status-utf8", 1);
 		options_set_number(wo, "utf8", 1);
 	} else {
@@ -435,7 +435,7 @@ main(int argc, char **argv)
 			exit(1);
 		}
 	}
-	
+
 	if (label == NULL)
 		label = xstrdup("default");
 	if (path == NULL && (path = makesockpath(label)) == NULL) {
@@ -450,14 +450,14 @@ main(int argc, char **argv)
 		len = 0;
 	} else {
 		fill_session(&cmddata);
-	
+
 		cmddata.argc = argc;
 		if (cmd_pack_argv(
 		    argc, argv, cmddata.argv, sizeof cmddata.argv) != 0) {
 			log_warnx("command too long");
 			exit(1);
 		}
-		
+
 		msg = MSG_COMMAND;
 		buf = &cmddata;
 		len = sizeof cmddata;
@@ -507,7 +507,7 @@ main(int argc, char **argv)
 	unsetenv("EVENT_NOPOLL");
 #endif
 
- 	imsg_compose(main_ibuf, msg, PROTOCOL_VERSION, -1, -1, buf, len);
+	imsg_compose(main_ibuf, msg, PROTOCOL_VERSION, -1, -1, buf, len);
 
 	main_set_signals();
 
@@ -543,7 +543,7 @@ main_set_signals(void)
 		fatal("sigaction failed");
 	if (sigaction(SIGTSTP, &sigact, NULL) != 0)
 		fatal("sigaction failed");
-	
+
 	signal_set(&main_ev_sigterm, SIGTERM, main_signal, NULL);
 	signal_add(&main_ev_sigterm, NULL);
 }
@@ -567,7 +567,7 @@ main_clear_signals(void)
 		fatal("sigaction failed");
 	if (sigaction(SIGTSTP, &sigact, NULL) != 0)
 		fatal("sigaction failed");
-	
+
 	event_del(&main_ev_sigterm);
 }
 
@@ -589,7 +589,7 @@ main_callback(unused int fd, short events, void *data)
 
 	if (events & EV_READ)
 		main_dispatch(shellcmd);
-	
+
 	if (events & EV_WRITE) {
 		if (msgbuf_write(&main_ibuf->w) < 0)
 			fatalx("msgbuf_write failed");
diff --git a/tmux.h b/tmux.h
index e2d44f86..a0becbf5 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.529 2009-12-04 22:11:23 tcunha Exp $ */
+/* $Id: tmux.h,v 1.530 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -339,9 +339,9 @@ enum tty_code_type {
 struct tty_code {
 	enum tty_code_type	type;
 	union {
-		char 	       *string;
-		int	 	number;
-		int	 	flag;
+		char	       *string;
+		int		number;
+		int		flag;
 	} value;
 };
 
@@ -403,15 +403,15 @@ struct msg_identify_data {
 };
 
 struct msg_lock_data {
-	char	       	cmd[COMMAND_LENGTH];
+	char		cmd[COMMAND_LENGTH];
 };
 
 struct msg_environ_data {
-	char	     	var[ENVIRON_LENGTH];
+	char		var[ENVIRON_LENGTH];
 };
 
 struct msg_shell_data {
-	char	       	shell[MAXPATHLEN];
+	char		shell[MAXPATHLEN];
 };
 
 /* Mode key commands. */
@@ -437,7 +437,7 @@ enum mode_key_cmd {
 	MODEKEYEDIT_SWITCHMODE,
 	MODEKEYEDIT_SWITCHMODEAPPEND,
 	MODEKEYEDIT_TRANSPOSECHARS,
-	
+
 	/* Menu (choice) keys. */
 	MODEKEYCHOICE_CANCEL,
 	MODEKEYCHOICE_CHOOSE,
@@ -510,13 +510,13 @@ SPLAY_HEAD(mode_key_tree, mode_key_binding);
 
 /* Command to string mapping. */
 struct mode_key_cmdstr {
-	enum mode_key_cmd      	 cmd;
+	enum mode_key_cmd	 cmd;
 	const char		*name;
 };
 
 /* Named mode key table description. */
 struct mode_key_table {
-	const char	       	*name;
+	const char		*name;
 	struct mode_key_cmdstr	*cmdstr;
 	struct mode_key_tree	*tree;
 	const struct mode_key_entry *table;	/* default entries */
@@ -682,7 +682,7 @@ struct screen_sel {
 struct screen {
 	char		*title;
 
-	struct grid     *grid;		/* grid data */
+	struct grid	*grid;		/* grid data */
 
 	u_int		 cx;		/* cursor x */
 	u_int		 cy;		/* cursor y */
@@ -692,7 +692,7 @@ struct screen {
 
 	int		 mode;
 
-	bitstr_t      	*tabs;
+	bitstr_t	*tabs;
 
 	struct screen_sel sel;
 };
@@ -742,7 +742,7 @@ struct input_ctx {
 	struct utf8_data utf8data;
 
 	u_char		 intermediate;
-	void 		*(*state)(u_char, struct input_ctx *);
+	void		*(*state)(u_char, struct input_ctx *);
 
 	u_char		 private;
 	ARRAY_DECL(, struct input_arg) args;
@@ -761,7 +761,7 @@ struct window_mode {
 	void	(*resize)(struct window_pane *, u_int, u_int);
 	void	(*key)(struct window_pane *, struct client *, int);
 	void	(*mouse)(struct window_pane *,
-	    	    struct client *, struct mouse_event *);
+		    struct client *, struct mouse_event *);
 	void	(*timer)(struct window_pane *);
 };
 
@@ -799,8 +799,8 @@ struct window_pane {
 	struct screen	 base;
 
 	/* Saved in alternative screen mode. */
- 	u_int		 saved_cx;
- 	u_int		 saved_cy;
+	u_int		 saved_cx;
+	u_int		 saved_cy;
 	struct grid	*saved_grid;
 	struct grid_cell saved_cell;
 
@@ -948,7 +948,7 @@ ARRAY_DECL(sessions, struct session *);
 /* TTY information. */
 struct tty_key {
 	char		 ch;
-	int	 	 key;
+	int		 key;
 
 	struct tty_key	*left;
 	struct tty_key	*right;
@@ -974,8 +974,8 @@ SLIST_HEAD(tty_terms, tty_term);
 struct tty {
 	char		*path;
 
-        u_int            sx;
-        u_int            sy;
+	u_int		 sx;
+	u_int		 sy;
 
 	u_int		 cx;
 	u_int		 cy;
@@ -993,7 +993,7 @@ struct tty {
 
 	int		 log_fd;
 
-	struct termios   tio;
+	struct termios	 tio;
 
 	struct grid_cell cell;
 
@@ -1005,7 +1005,7 @@ struct tty {
 #define TTY_UTF8 0x8
 #define TTY_STARTED 0x10
 #define TTY_OPENED 0x20
-	int    		 flags;
+	int		 flags;
 
 	int		 term_flags;
 
@@ -1068,7 +1068,7 @@ struct client {
 	char		*title;
 	char		*cwd;
 
-	struct tty 	 tty;
+	struct tty	 tty;
 	struct event	 repeat_timer;
 
 	struct timeval	 status_timer;
@@ -1145,7 +1145,7 @@ struct cmd_ctx {
 
 struct cmd {
 	const struct cmd_entry *entry;
-	void	       	*data;
+	void		*data;
 
 	TAILQ_ENTRY(cmd) qentry;
 };
@@ -1171,7 +1171,7 @@ struct cmd_entry {
 	int		 (*parse)(struct cmd *, int, char **, char **);
 	int		 (*exec)(struct cmd *, struct cmd_ctx *);
 	void		 (*free)(struct cmd *);
-	size_t 		 (*print)(struct cmd *, char *, size_t);
+	size_t		 (*print)(struct cmd *, char *, size_t);
 };
 
 /* Generic command data. */
@@ -1241,7 +1241,7 @@ extern char	*cfg_file;
 extern int	 debug_level;
 extern int	 be_quiet;
 extern time_t	 start_time;
-extern char 	*socket_path;
+extern char	*socket_path;
 extern int	 login_shell;
 void		 logfile(const char *);
 const char	*getshell(void);
@@ -1277,13 +1277,13 @@ struct options_entry *options_find1(struct options *, const char *);
 struct options_entry *options_find(struct options *, const char *);
 void	options_remove(struct options *, const char *);
 struct options_entry *printflike3 options_set_string(
-    	    struct options *, const char *, const char *, ...);
+	    struct options *, const char *, const char *, ...);
 char   *options_get_string(struct options *, const char *);
 struct options_entry *options_set_number(
-    	    struct options *, const char *, long long);
+	    struct options *, const char *, long long);
 long long options_get_number(struct options *, const char *);
 struct options_entry *options_set_data(
-    	    struct options *, const char *, void *, void (*)(void *));
+	    struct options *, const char *, void *, void (*)(void *));
 void   *options_get_data(struct options *, const char *);
 
 /* job.c */
@@ -1311,7 +1311,7 @@ struct environ_entry *environ_find(struct environ *, const char *);
 void	environ_set(struct environ *, const char *, const char *);
 void	environ_put(struct environ *, const char *);
 void	environ_unset(struct environ *, const char *);
-void 	environ_update(const char *, struct environ *, struct environ *);
+void	environ_update(const char *, struct environ *, struct environ *);
 
 /* tty.c */
 void	tty_raw(struct tty *, const char *);
@@ -1360,12 +1360,12 @@ void	tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
 extern struct tty_terms tty_terms;
 extern struct tty_term_code_entry tty_term_codes[NTTYCODE];
 struct tty_term *tty_term_find(char *, int, const char *, char **);
-void 		 tty_term_free(struct tty_term *);
+void		 tty_term_free(struct tty_term *);
 int		 tty_term_has(struct tty_term *, enum tty_code_code);
 const char	*tty_term_string(struct tty_term *, enum tty_code_code);
 const char	*tty_term_string1(struct tty_term *, enum tty_code_code, int);
 const char	*tty_term_string2(
-    		     struct tty_term *, enum tty_code_code, int, int);
+		     struct tty_term *, enum tty_code_code, int, int);
 int		 tty_term_number(struct tty_term *, enum tty_code_code);
 int		 tty_term_flag(struct tty_term *, enum tty_code_code);
 
@@ -1380,7 +1380,7 @@ void		 paste_free_stack(struct paste_stack *);
 struct paste_buffer *paste_walk_stack(struct paste_stack *, uint *);
 struct paste_buffer *paste_get_top(struct paste_stack *);
 struct paste_buffer *paste_get_index(struct paste_stack *, u_int);
-int	     	 paste_free_top(struct paste_stack *);
+int		 paste_free_top(struct paste_stack *);
 int		 paste_free_index(struct paste_stack *, u_int);
 void		 paste_add(struct paste_stack *, char *, size_t, u_int);
 int		 paste_replace(struct paste_stack *, u_int, char *, size_t);
@@ -1392,7 +1392,7 @@ void		 clock_draw(struct screen_write_ctx *, int, int);
 /* cmd-set-option.c */
 extern const struct set_option_entry set_session_option_table[];
 extern const struct set_option_entry set_window_option_table[];
-const char 	*cmd_set_option_print(
+const char	*cmd_set_option_print(
 		    const struct set_option_entry *, struct options_entry *);
 
 /* cmd.c */
@@ -1507,7 +1507,7 @@ size_t		 cmd_list_print(struct cmd_list *, char *, size_t);
 int	cmd_string_parse(const char *, struct cmd_list **, char **);
 
 /* cmd-generic.c */
-size_t  cmd_prarg(char *, size_t, const char *, char *);
+size_t	cmd_prarg(char *, size_t, const char *, char *);
 int	cmd_check_flag(uint64_t, int);
 void	cmd_set_flag(uint64_t *, int);
 #define CMD_TARGET_PANE_USAGE "[-t target-pane]"
@@ -1579,9 +1579,9 @@ void	 server_window_loop(void);
 void	 server_fill_environ(struct session *, struct environ *);
 void	 server_write_error(struct client *, const char *);
 void	 server_write_client(
-             struct client *, enum msgtype, const void *, size_t);
+	     struct client *, enum msgtype, const void *, size_t);
 void	 server_write_session(
-             struct session *, enum msgtype, const void *, size_t);
+	     struct session *, enum msgtype, const void *, size_t);
 void	 server_redraw_client(struct client *);
 void	 server_status_client(struct client *);
 void	 server_redraw_session(struct session *);
@@ -1608,12 +1608,12 @@ void	 server_update_event(struct client *);
 /* status.c */
 int	 status_redraw(struct client *);
 char	*status_replace(
-    	     struct client *, struct winlink *, const char *, time_t, int);
+	     struct client *, struct winlink *, const char *, time_t, int);
 void printflike2 status_message_set(struct client *, const char *, ...);
 void	 status_message_clear(struct client *);
 int	 status_message_redraw(struct client *);
 void	 status_prompt_set(struct client *, const char *,
-    	     int (*)(void *, const char *), void (*)(void *), void *, int);
+	     int (*)(void *, const char *), void (*)(void *), void *, int);
 void	 status_prompt_clear(struct client *);
 int	 status_prompt_redraw(struct client *);
 void	 status_prompt_key(struct client *, int);
@@ -1632,7 +1632,7 @@ void	 input_key(struct window_pane *, int);
 void	 input_mouse(struct window_pane *, struct mouse_event *);
 
 /* xterm-keys.c */
-char 	*xterm_keys_lookup(int);
+char	*xterm_keys_lookup(int);
 int	 xterm_keys_find(const char *, size_t, size_t *, int *);
 
 /* colour.c */
@@ -1669,7 +1669,7 @@ void	 grid_move_lines(struct grid *, u_int, u_int, u_int);
 void	 grid_move_cells(struct grid *, u_int, u_int, u_int, u_int);
 char	*grid_string_cells(struct grid *, u_int, u_int, u_int);
 void	 grid_duplicate_lines(
-    	     struct grid *, u_int, struct grid *, u_int, u_int);
+	     struct grid *, u_int, struct grid *, u_int, u_int);
 
 /* grid-utf8.c */
 size_t	 grid_utf8_size(const struct grid_utf8 *);
@@ -1682,11 +1682,11 @@ int	 grid_utf8_compare(const struct grid_utf8 *, const struct grid_utf8 *);
 const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int);
 struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int);
 void	 grid_view_set_cell(
-    	     struct grid *, u_int, u_int, const struct grid_cell *);
+	     struct grid *, u_int, u_int, const struct grid_cell *);
 const struct grid_utf8 *grid_view_peek_utf8(struct grid *, u_int, u_int);
 struct grid_utf8 *grid_view_get_utf8(struct grid *, u_int, u_int);
 void	 grid_view_set_utf8(
-    	     struct grid *, u_int, u_int, const struct grid_utf8 *);
+	     struct grid *, u_int, u_int, const struct grid_utf8 *);
 void	 grid_view_clear(struct grid *, u_int, u_int, u_int, u_int);
 void	 grid_view_scroll_region_up(struct grid *, u_int, u_int);
 void	 grid_view_scroll_region_down(struct grid *, u_int, u_int);
@@ -1700,22 +1700,22 @@ char	*grid_view_string_cells(struct grid *, u_int, u_int, u_int);
 
 /* screen-write.c */
 void	 screen_write_start(
-    	     struct screen_write_ctx *, struct window_pane *, struct screen *);
+	     struct screen_write_ctx *, struct window_pane *, struct screen *);
 void	 screen_write_stop(struct screen_write_ctx *);
 size_t printflike2 screen_write_cstrlen(int, const char *, ...);
 void printflike5 screen_write_cnputs(struct screen_write_ctx *,
-    ssize_t, struct grid_cell *, int, const char *, ...);
+	     ssize_t, struct grid_cell *, int, const char *, ...);
 size_t printflike2 screen_write_strlen(int, const char *, ...);
 void printflike3 screen_write_puts(struct screen_write_ctx *,
-    	     struct grid_cell *, const char *, ...);
+	     struct grid_cell *, const char *, ...);
 void printflike5 screen_write_nputs(struct screen_write_ctx *,
-    ssize_t, struct grid_cell *, int, const char *, ...);
+	     ssize_t, struct grid_cell *, int, const char *, ...);
 void	 screen_write_vnputs(struct screen_write_ctx *,
 	     ssize_t, struct grid_cell *, int, const char *, va_list);
 void	 screen_write_parsestyle(
-    	     struct grid_cell *, struct grid_cell *, const char *);
+	     struct grid_cell *, struct grid_cell *, const char *);
 void	 screen_write_putc(
-    	     struct screen_write_ctx *, struct grid_cell *, u_char);
+	     struct screen_write_ctx *, struct grid_cell *, u_char);
 void	 screen_write_copy(struct screen_write_ctx *,
 	     struct screen *, u_int, u_int, u_int, u_int);
 void	 screen_write_backspace(struct screen_write_ctx *);
@@ -1746,7 +1746,7 @@ void	 screen_write_clearendofscreen(struct screen_write_ctx *);
 void	 screen_write_clearstartofscreen(struct screen_write_ctx *);
 void	 screen_write_clearscreen(struct screen_write_ctx *);
 void	 screen_write_cell(struct screen_write_ctx *,
-    	     const struct grid_cell *, const struct utf8_data *);
+	     const struct grid_cell *, const struct utf8_data *);
 
 /* screen-redraw.c */
 void	 screen_redraw_screen(struct client *, int);
@@ -1771,7 +1771,7 @@ int		 winlink_cmp(struct winlink *, struct winlink *);
 RB_PROTOTYPE(windows, window, entry, window_cmp);
 RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
 struct winlink	*winlink_find_by_index(struct winlinks *, int);
-struct winlink 	*winlink_find_by_window(struct winlinks *, struct window *);
+struct winlink	*winlink_find_by_window(struct winlinks *, struct window *);
 int		 winlink_next_index(struct winlinks *, int);
 u_int		 winlink_count(struct winlinks *);
 struct winlink	*winlink_add(struct winlinks *, struct window *, int);
@@ -1780,11 +1780,11 @@ struct winlink	*winlink_next(struct winlink *);
 struct winlink	*winlink_previous(struct winlink *);
 void		 winlink_stack_push(struct winlink_stack *, struct winlink *);
 void		 winlink_stack_remove(struct winlink_stack *, struct winlink *);
-int	 	 window_index(struct window *, u_int *);
+int		 window_index(struct window *, u_int *);
 struct window	*window_create1(u_int, u_int);
 struct window	*window_create(const char *, const char *, const char *,
 		     const char *, struct environ *, struct termios *,
-    		     u_int, u_int, u_int, char **);
+		     u_int, u_int, u_int, char **);
 void		 window_destroy(struct window *);
 void		 window_set_active_at(struct window *, u_int, u_int);
 void		 window_set_active_pane(struct window *, struct window_pane *);
@@ -1807,10 +1807,10 @@ void		 window_pane_reset_mode(struct window_pane *);
 void		 window_pane_parse(struct window_pane *);
 void		 window_pane_key(struct window_pane *, struct client *, int);
 void		 window_pane_mouse(struct window_pane *,
-    		     struct client *, struct mouse_event *);
+		     struct client *, struct mouse_event *);
 int		 window_pane_visible(struct window_pane *);
 char		*window_pane_search(
-    		     struct window_pane *, const char *, u_int *);
+		     struct window_pane *, const char *, u_int *);
 
 /* layout.c */
 struct layout_cell *layout_create_cell(struct layout_cell *);
@@ -1830,7 +1830,7 @@ void		 layout_init(struct window *);
 void		 layout_free(struct window *);
 void		 layout_resize(struct window *, u_int, u_int);
 void		 layout_resize_pane(
-    		     struct window_pane *, enum layout_type, int);
+		     struct window_pane *, enum layout_type, int);
 int		 layout_split_pane(struct window_pane *,
 		     enum layout_type, int, struct window_pane *);
 void		 layout_close_pane(struct window_pane *);
@@ -1848,24 +1848,24 @@ extern const struct window_mode window_clock_mode;
 
 /* window-copy.c */
 extern const struct window_mode window_copy_mode;
-void 		 window_copy_pageup(struct window_pane *);
+void		 window_copy_pageup(struct window_pane *);
 
 /* window-more.c */
 extern const struct window_mode window_more_mode;
-void 		 window_more_vadd(struct window_pane *, const char *, va_list);
+void		 window_more_vadd(struct window_pane *, const char *, va_list);
 
 /* window-choose.c */
 extern const struct window_mode window_choose_mode;
-void 		 window_choose_vadd(
-    		     struct window_pane *, int, const char *, va_list);
+void		 window_choose_vadd(
+		     struct window_pane *, int, const char *, va_list);
 void printflike3 window_choose_add(
-    		     struct window_pane *, int, const char *, ...);
+		     struct window_pane *, int, const char *, ...);
 void		 window_choose_ready(struct window_pane *,
 		     u_int, void (*)(void *, int), void (*)(void *), void *);
 
 /* names.c */
 void		 queue_window_name(struct window *);
-char 		*default_window_name(struct window *);
+char		*default_window_name(struct window *);
 
 /* session.c */
 extern struct sessions sessions;
@@ -1879,12 +1879,12 @@ struct session	*session_find(const char *);
 struct session	*session_create(const char *, const char *, const char *,
 		     struct environ *, struct termios *, int, u_int, u_int,
 		     char **);
-void	 	 session_destroy(struct session *);
-int	 	 session_index(struct session *, u_int *);
+void		 session_destroy(struct session *);
+int		 session_index(struct session *, u_int *);
 struct winlink	*session_new(struct session *,
-	    	     const char *, const char *, const char *, int, char **);
+		     const char *, const char *, const char *, int, char **);
 struct winlink	*session_attach(
-    		     struct session *, struct window *, int, char **);
+		     struct session *, struct window *, int, char **);
 int		 session_detach(struct session *, struct winlink *);
 int		 session_has(struct session *, struct window *);
 int		 session_next(struct session *, int);
diff --git a/tty-keys.c b/tty-keys.c
index ecb7ce22..7b0632bb 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -1,4 +1,4 @@
-/* $Id: tty-keys.c,v 1.52 2009-12-02 15:07:28 tcunha Exp $ */
+/* $Id: tty-keys.c,v 1.53 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -35,7 +35,7 @@ void		tty_keys_add1(struct tty_key **, const char *, int);
 void		tty_keys_add(struct tty *, const char *, int);
 void		tty_keys_free1(struct tty_key *);
 struct tty_key *tty_keys_find1(
-    		    struct tty_key *, const char *, size_t, size_t *);
+		    struct tty_key *, const char *, size_t, size_t *);
 struct tty_key *tty_keys_find(struct tty *, const char *, size_t, size_t *);
 void		tty_keys_callback(int, short, void *);
 int		tty_keys_mouse(
@@ -50,7 +50,7 @@ struct tty_key_ent {
 #define TTYKEY_RAW 0x1
 };
 
-/* 
+/*
  * Default key tables. Those flagged with TTYKEY_RAW are inserted directly,
  * otherwise they are looked up in terminfo(5).
  */
@@ -319,7 +319,7 @@ tty_keys_add1(struct tty_key **tkp, const char *s, int key)
 
 		/* Use the child tree for the next character. */
 		tkp = &tk->next;
-	} else { 
+	} else {
 		if (*s < tk->ch)
 			tkp = &tk->left;
 		else if (*s > tk->ch)
@@ -374,7 +374,7 @@ tty_keys_free1(struct tty_key *tk)
 	if (tk->right != NULL)
 		tty_keys_free1(tk->right);
 	xfree(tk);
-	
+
 }
 
 /* Lookup a key in the tree. */
@@ -523,11 +523,11 @@ start_timer:
 	/* Start the timer and wait for expiry or more data. */
 	tv.tv_sec = 0;
 	tv.tv_usec = ESCAPE_PERIOD * 1000L;
-	
+
 	evtimer_del(&tty->key_timer);
 	evtimer_set(&tty->key_timer, tty_keys_callback, tty);
 	evtimer_add(&tty->key_timer, &tv);
-	
+
 	tty->flags |= TTY_ESCAPE;
 	return (0);
 
@@ -548,7 +548,7 @@ found_key:
 	goto handle_key;
 
 handle_key:
- 	evtimer_del(&tty->key_timer);
+	evtimer_del(&tty->key_timer);
 
 	tty->key_callback(key, &mouse, tty->key_data);
 
@@ -570,7 +570,7 @@ tty_keys_callback(unused int fd, unused short events, void *data)
 		;
 }
 
-/* 
+/*
  * Handle mouse key input. Returns 0 for success, -1 for failure, 1 for partial
  * (probably a mouse sequence but need more data).
  */
@@ -593,7 +593,7 @@ tty_keys_mouse(const char *buf, size_t len, size_t *size, struct mouse_event *m)
 		return (-1);
 	if (len == 2)
 		return (1);
-		
+
 	if (buf[2] != 'M')
 		return (-1);
 	if (len == 3)
diff --git a/tty-term.c b/tty-term.c
index a8cd5fd1..dc6b0f01 100644
--- a/tty-term.c
+++ b/tty-term.c
@@ -1,4 +1,4 @@
-/* $Id: tty-term.c,v 1.39 2009-12-03 14:33:27 nicm Exp $ */
+/* $Id: tty-term.c,v 1.40 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -230,7 +230,7 @@ tty_term_override(struct tty_term *term, const char *overrides)
 	termnext = s;
 	while ((termstr = strsep(&termnext, ",")) != NULL) {
 		entnext = termstr;
-		
+
 		entstr = strsep(&entnext, ":");
 		if (entstr == NULL || entnext == NULL)
 			continue;
@@ -242,7 +242,7 @@ tty_term_override(struct tty_term *term, const char *overrides)
 
 			val = NULL;
 			removeflag = 0;
- 			if ((ptr = strchr(entstr, '=')) != NULL) {
+			if ((ptr = strchr(entstr, '=')) != NULL) {
 				*ptr++ = '\0';
 				val = xstrdup(ptr);
 				if (strunvis(val, ptr) == -1) {
@@ -324,10 +324,12 @@ tty_term_find(char *name, int fd, const char *overrides, char **cause)
 	if (setupterm(name, fd, &error) != OK) {
 		switch (error) {
 		case 1:
-			xasprintf(cause, "can't use hardcopy terminal: %s", name);
+			xasprintf(
+			    cause, "can't use hardcopy terminal: %s", name);
 			break;
 		case 0:
-			xasprintf(cause, "missing or unsuitable terminal: %s", name);
+			xasprintf(
+			    cause, "missing or unsuitable terminal: %s", name);
 			break;
 		case -1:
 			xasprintf(cause, "can't find terminfo database");
diff --git a/tty.c b/tty.c
index ba0071be..2ebaf475 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.180 2009-12-04 22:05:52 tcunha Exp $ */
+/* $Id: tty.c,v 1.181 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,7 +44,7 @@ void	tty_redraw_region(struct tty *, const struct tty_ctx *);
 void	tty_emulate_repeat(
 	    struct tty *, enum tty_code_code, enum tty_code_code, u_int);
 void	tty_cell(struct tty *,
-    	    const struct grid_cell *, const struct grid_utf8 *);
+	    const struct grid_cell *, const struct grid_utf8 *);
 
 void
 tty_init(struct tty *tty, int fd, char *term)
@@ -507,7 +507,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
 		if (screen_check_selection(s, i, py)) {
 			memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc);
 			tmpgc.data = gc->data;
-			tmpgc.flags = gc->flags & 
+			tmpgc.flags = gc->flags &
 			    ~(GRID_FLAG_FG256|GRID_FLAG_BG256);
 			tmpgc.flags |= s->sel.cell.flags &
 			    (GRID_FLAG_FG256|GRID_FLAG_BG256);
@@ -567,7 +567,7 @@ tty_write(void (*cmdfn)(
 void
 tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 	u_int			 i;
 
@@ -578,12 +578,12 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
 
 	tty_reset(tty);
 
- 	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
+	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
 
 	if (tty_term_has(tty->term, TTYC_ICH) ||
 	    tty_term_has(tty->term, TTYC_ICH1))
 		tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num);
-	else if (tty_term_has(tty->term, TTYC_SMIR) && 
+	else if (tty_term_has(tty->term, TTYC_SMIR) &&
 	    tty_term_has(tty->term, TTYC_RMIR)) {
 		tty_putcode(tty, TTYC_SMIR);
 		for (i = 0; i < ctx->num; i++)
@@ -596,7 +596,7 @@ tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 
 	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
@@ -608,7 +608,7 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
 
 	tty_reset(tty);
 
- 	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
+	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
 
 	if (tty_term_has(tty->term, TTYC_DCH) ||
 	    tty_term_has(tty->term, TTYC_DCH1))
@@ -618,11 +618,11 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 
- 	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
-	    !tty_term_has(tty->term, TTYC_CSR) || 
+	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
+	    !tty_term_has(tty->term, TTYC_CSR) ||
 	    !tty_term_has(tty->term, TTYC_IL1)) {
 		tty_redraw_region(tty, ctx);
 		return;
@@ -630,8 +630,8 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
 
 	tty_reset(tty);
 
- 	tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
- 	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
+	tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
+	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
 
 	tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num);
 }
@@ -639,10 +639,10 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 
- 	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
+	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
 	    !tty_term_has(tty->term, TTYC_CSR) ||
 	    !tty_term_has(tty->term, TTYC_DL1)) {
 		tty_redraw_region(tty, ctx);
@@ -651,8 +651,8 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
 
 	tty_reset(tty);
 
- 	tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
- 	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
+	tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
+	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
 
 	tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);
 }
@@ -660,13 +660,13 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 	u_int		 	 i;
 
 	tty_reset(tty);
 
- 	tty_cursor_pane(tty, ctx, 0, ctx->ocy);
+	tty_cursor_pane(tty, ctx, 0, ctx->ocy);
 
 	if (wp->xoff == 0 && screen_size_x(s) >= tty->sx &&
 	    tty_term_has(tty->term, TTYC_EL)) {
@@ -680,7 +680,7 @@ tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 	u_int		 	 i;
 
@@ -700,7 +700,7 @@ tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	u_int		 	 i;
 
 	tty_reset(tty);
@@ -718,13 +718,13 @@ tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 
 	if (ctx->ocy != ctx->orupper)
 		return;
 
- 	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
+	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
 	    !tty_term_has(tty->term, TTYC_CSR) ||
 	    !tty_term_has(tty->term, TTYC_RI)) {
 		tty_redraw_region(tty, ctx);
@@ -732,23 +732,23 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
 	}
 
 	tty_reset(tty);
-	
+
 	tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
 	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
-	
+
 	tty_putcode(tty, TTYC_RI);
 }
 
 void
 tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 
 	if (ctx->ocy != ctx->orlower)
 		return;
 
- 	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
+	if (wp->xoff != 0 || screen_size_x(s) < tty->sx ||
 	    !tty_term_has(tty->term, TTYC_CSR)) {
 		tty_redraw_region(tty, ctx);
 		return;
@@ -763,17 +763,17 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx)
 		return;
 
 	tty_reset(tty);
-	
+
 	tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
 	tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
-	
+
 	tty_putc(tty, '\n');
 }
 
 void
 tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 	u_int		 	 i, j;
 
@@ -809,7 +809,7 @@ tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx)
 {
- 	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 	u_int		 	 i, j;
 
@@ -839,7 +839,7 @@ tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx)
 void
 tty_cmd_clearscreen(struct tty *tty, const struct tty_ctx *ctx)
 {
- 	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 	struct screen		*s = wp->screen;
 	u_int		 	 i, j;
 
@@ -926,7 +926,7 @@ tty_cmd_utf8character(struct tty *tty, const struct tty_ctx *ctx)
 	 * Cannot rely on not being a partial character, so just redraw the
 	 * whole line.
 	 */
-	tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);	
+	tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff);
 }
 
 void
@@ -985,7 +985,7 @@ void
 tty_region_pane(
     struct tty *tty, const struct tty_ctx *ctx, u_int rupper, u_int rlower)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 
 	tty_region(tty, wp->yoff + rupper, wp->yoff + rlower);
 }
@@ -1021,7 +1021,7 @@ tty_region(struct tty *tty, u_int rupper, u_int rlower)
 void
 tty_cursor_pane(struct tty *tty, const struct tty_ctx *ctx, u_int cx, u_int cy)
 {
-  	struct window_pane	*wp = ctx->wp;
+	struct window_pane	*wp = ctx->wp;
 
 	tty_cursor(tty, wp->xoff + cx, wp->yoff + cy);
 }
@@ -1033,7 +1033,7 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
 	struct tty_term	*term = tty->term;
 	u_int		 thisx, thisy;
 	int		 change;
-	
+
 	if (cx > tty->sx - 1)
 		cx = tty->sx - 1;
 
@@ -1108,7 +1108,7 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
 		 */
 
 		/* One above. */
-		if (thisy != tty->rupper && 
+		if (thisy != tty->rupper &&
 		    cy == thisy - 1 && tty_term_has(term, TTYC_CUU1)) {
 			tty_putcode(tty, TTYC_CUU1);
 			goto out;
@@ -1125,8 +1125,8 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
 		change = thisy - cy;	/* +ve up, -ve down */
 
 		/*
-		 * Try to use VPA if change is larger than absolute or if this change
-		 * would cross the scroll region, otherwise use CUU/CUD.
+		 * Try to use VPA if change is larger than absolute or if this
+		 * change would cross the scroll region, otherwise use CUU/CUD.
 		 */
 		if (abs(change) > cy ||
 		    (change < 0 && cy - change > tty->rlower) ||
@@ -1270,7 +1270,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, u_char *attr)
 			}
 			if (bg_default &&
 			    bg != tc->bg && !(tc->flags & GRID_FLAG_BG256)) {
-				if (have_ax)					
+				if (have_ax)
 					tty_puts(tty, "\033[49m");
 				else if (tc->bg != 0)
 					tty_putcode1(tty, TTYC_SETAB, 0);
@@ -1320,7 +1320,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc, u_char *attr)
 	/* Otherwise set the foreground colour. */
 	tty_putcode1(tty, TTYC_SETAF, fg);
 
-save_fg:	
+save_fg:
 	/* Save the new values in the terminal current cell. */
 	tc->fg = fg;
 	tc->flags &= ~GRID_FLAG_FG256;
diff --git a/window-choose.c b/window-choose.c
index 6dac57d1..6cb2a600 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -1,4 +1,4 @@
-/* $Id: window-choose.c,v 1.26 2009-11-28 14:50:37 tcunha Exp $ */
+/* $Id: window-choose.c,v 1.27 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -27,11 +27,11 @@ void	window_choose_free(struct window_pane *);
 void	window_choose_resize(struct window_pane *, u_int, u_int);
 void	window_choose_key(struct window_pane *, struct client *, int);
 void	window_choose_mouse(
-    	    struct window_pane *, struct client *, struct mouse_event *);
+	    struct window_pane *, struct client *, struct mouse_event *);
 
 void	window_choose_redraw_screen(struct window_pane *);
 void	window_choose_write_line(
-    	    struct window_pane *, struct screen_write_ctx *, u_int);
+	    struct window_pane *, struct screen_write_ctx *, u_int);
 
 void	window_choose_scroll_up(struct window_pane *);
 void	window_choose_scroll_down(struct window_pane *);
@@ -247,7 +247,7 @@ window_choose_key(struct window_pane *wp, unused struct client *c, int key)
 			else
 				data->top -= screen_size_y(s);
 		}
- 		window_choose_redraw_screen(wp);
+		window_choose_redraw_screen(wp);
 		break;
 	case MODEKEYCHOICE_PAGEDOWN:
 		data->selected += screen_size_y(s);
@@ -268,7 +268,7 @@ window_choose_key(struct window_pane *wp, unused struct client *c, int key)
 		if (idx < 0 || (u_int) idx >= ARRAY_LENGTH(&data->list))
 			break;
 		data->selected = idx;
-		
+
 		item = &ARRAY_ITEM(&data->list, data->selected);
 		data->callbackfn(data->data, item->idx);
 		window_pane_reset_mode(wp);
@@ -312,7 +312,7 @@ window_choose_write_line(
 	struct options			*oo = &wp->window->options;
 	struct screen			*s = &data->screen;
 	struct grid_cell		 gc;
- 	int				 utf8flag;
+	int				 utf8flag;
 	char				 key;
 
 	if (data->callbackfn == NULL)
diff --git a/window-clock.c b/window-clock.c
index a8c4e2ed..368dd327 100644
--- a/window-clock.c
+++ b/window-clock.c
@@ -1,4 +1,4 @@
-/* $Id: window-clock.c,v 1.10 2009-11-28 14:57:59 tcunha Exp $ */
+/* $Id: window-clock.c,v 1.11 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -78,7 +78,7 @@ window_clock_resize(struct window_pane *wp, u_int sx, u_int sy)
 	struct window_clock_mode_data	*data = wp->modedata;
 	struct screen			*s = &data->screen;
 
- 	screen_resize(s, sx, sy);
+	screen_resize(s, sx, sy);
 	window_clock_draw_screen(wp);
 }
 
diff --git a/window-copy.c b/window-copy.c
index 340825bd..05194ae3 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1,4 +1,4 @@
-/* $Id: window-copy.c,v 1.93 2009-11-28 14:50:37 tcunha Exp $ */
+/* $Id: window-copy.c,v 1.94 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,14 +29,14 @@ void	window_copy_resize(struct window_pane *, u_int, u_int);
 void	window_copy_key(struct window_pane *, struct client *, int);
 int	window_copy_key_input(struct window_pane *, int);
 void	window_copy_mouse(
-    	    struct window_pane *, struct client *, struct mouse_event *);
+	    struct window_pane *, struct client *, struct mouse_event *);
 
 void	window_copy_redraw_lines(struct window_pane *, u_int, u_int);
 void	window_copy_redraw_screen(struct window_pane *);
 void	window_copy_write_line(
-    	    struct window_pane *, struct screen_write_ctx *, u_int);
+	    struct window_pane *, struct screen_write_ctx *, u_int);
 void	window_copy_write_lines(
-    	    struct window_pane *, struct screen_write_ctx *, u_int, u_int);
+	    struct window_pane *, struct screen_write_ctx *, u_int, u_int);
 
 void	window_copy_scroll_to(struct window_pane *, u_int, u_int);
 int	window_copy_search_compare(
@@ -195,7 +195,7 @@ window_copy_resize(struct window_pane *wp, u_int sx, u_int sy)
 	struct screen_write_ctx	 	 ctx;
 
 	screen_resize(s, sx, sy);
-	
+
 	if (data->cy > sy - 1)
 		data->cy = sy - 1;
 	if (data->cx > sx)
@@ -233,7 +233,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
 		return;
 	case MODEKEYCOPY_RIGHT:
 		window_copy_cursor_right(wp);
- 		return;
+		return;
 	case MODEKEYCOPY_UP:
 		window_copy_cursor_up(wp, 0);
 		return;
@@ -297,7 +297,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
 		window_copy_redraw_screen(wp);
 		break;
 	case MODEKEYCOPY_STARTSELECTION:
- 		window_copy_start_selection(wp);
+		window_copy_start_selection(wp);
 		window_copy_redraw_screen(wp);
 		break;
 	case MODEKEYCOPY_CLEARSELECTION:
@@ -422,7 +422,7 @@ window_copy_key_input(struct window_pane *wp, int key)
 		if (key < 32 || key > 126)
 			break;
 		inputlen = strlen(data->inputstr) + 2;
-		
+
 		data->inputstr = xrealloc(data->inputstr, 1, inputlen);
 		data->inputstr[inputlen - 2] = key;
 		data->inputstr[inputlen - 1] = '\0';
@@ -452,7 +452,7 @@ window_copy_mouse(
 
 	window_copy_update_cursor(wp, m->x, m->y);
 	if (window_copy_update_selection(wp))
- 		window_copy_redraw_screen(wp);
+		window_copy_redraw_screen(wp);
 }
 
 void
@@ -476,7 +476,7 @@ window_copy_scroll_to(struct window_pane *wp, u_int px, u_int py)
 		offset = py + gap - gd->sy;
 		data->cy = py - offset;
 	}
- 	data->oy = gd->hsize - offset;
+	data->oy = gd->hsize - offset;
 
 	window_copy_redraw_screen(wp);
 }
@@ -490,7 +490,7 @@ window_copy_search_compare(
 
 	gc = grid_peek_cell(gd, px, py);
 	sgc = grid_peek_cell(sgd, spx, 0);
-	
+
 	if ((gc->flags & GRID_FLAG_UTF8) != (sgc->flags & GRID_FLAG_UTF8))
 		return (0);
 
@@ -674,7 +674,7 @@ window_copy_goto_line(struct window_pane *wp, const char *linestr)
 	lineno = strtonum(linestr, 0, screen_hsize(&wp->base), &errstr);
 	if (errstr != NULL)
 		return;
-	
+
 	data->oy = lineno;
 	window_copy_redraw_screen(wp);
 }
@@ -893,8 +893,8 @@ window_copy_copy_line(struct window_pane *wp,
     char **buf, size_t *off, u_int sy, u_int sx, u_int ex)
 {
 	struct grid		*gd = wp->base.grid;
- 	const struct grid_cell	*gc;
- 	const struct grid_utf8	*gu;
+	const struct grid_cell	*gc;
+	const struct grid_utf8	*gu;
 	struct grid_line	*gl;
 	u_int			 i, xx, wrapped = 0;
 	size_t			 size;
@@ -907,7 +907,7 @@ window_copy_copy_line(struct window_pane *wp,
 	 * on screen.
 	 */
 	gl = &gd->linedata[sy];
- 	if (gl->flags & GRID_LINE_WRAPPED && gl->cellsize <= gd->sx)
+	if (gl->flags & GRID_LINE_WRAPPED && gl->cellsize <= gd->sx)
 		wrapped = 1;
 
 	/* If the line was wrapped, don't strip spaces (use the full length). */
@@ -938,7 +938,7 @@ window_copy_copy_line(struct window_pane *wp,
 	}
 
 	/* Only add a newline if the line wasn't wrapped. */
- 	if (!wrapped) {
+	if (!wrapped) {
 		*buf = xrealloc(*buf, 1, (*off) + 1);
 		(*buf)[(*off)++] = '\n';
 	}
diff --git a/window-more.c b/window-more.c
index e2708e89..79095870 100644
--- a/window-more.c
+++ b/window-more.c
@@ -1,4 +1,4 @@
-/* $Id: window-more.c,v 1.39 2009-11-28 14:50:37 tcunha Exp $ */
+/* $Id: window-more.c,v 1.40 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,7 +29,7 @@ void	window_more_key(struct window_pane *, struct client *, int);
 
 void	window_more_redraw_screen(struct window_pane *);
 void	window_more_write_line(
-    	    struct window_pane *, struct screen_write_ctx *, u_int);
+	    struct window_pane *, struct screen_write_ctx *, u_int);
 
 void	window_more_scroll_up(struct window_pane *);
 void	window_more_scroll_down(struct window_pane *);
@@ -165,11 +165,11 @@ window_more_write_line(
 {
 	struct window_more_mode_data	*data = wp->modedata;
 	struct screen			*s = &data->screen;
-	struct options			*oo = &wp->window->options;	
+	struct options			*oo = &wp->window->options;
 	struct grid_cell		 gc;
 	char   				*msg, hdr[32];
 	size_t	 			 size;
- 	int				 utf8flag;
+	int				 utf8flag;
 
 	utf8flag = options_get_number(&wp->window->options, "utf8");
 	memcpy(&gc, &grid_default_cell, sizeof gc);
diff --git a/window.c b/window.c
index 216db181..10f9f167 100644
--- a/window.c
+++ b/window.c
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.124 2009-11-28 14:50:37 tcunha Exp $ */
+/* $Id: window.c,v 1.125 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -187,7 +187,7 @@ winlink_stack_remove(struct winlink_stack *stack, struct winlink *wl)
 
 	if (wl == NULL)
 		return;
-	
+
 	TAILQ_FOREACH(wl2, stack, sentry) {
 		if (wl2 == wl) {
 			TAILQ_REMOVE(stack, wl, sentry);
@@ -221,7 +221,7 @@ window_create1(u_int sx, u_int sy)
 
 	w->lastlayout = -1;
 	w->layout_root = NULL;
-	
+
 	w->sx = sx;
 	w->sy = sy;
 
@@ -426,7 +426,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
 	wp->layout_cell = NULL;
 
 	wp->xoff = 0;
- 	wp->yoff = 0;
+	wp->yoff = 0;
 
 	wp->sx = sx;
 	wp->sy = sy;
@@ -511,7 +511,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
 	ws.ws_col = screen_size_x(&wp->base);
 	ws.ws_row = screen_size_y(&wp->base);
 
- 	switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) {
+	switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) {
 	case -1:
 		wp->fd = -1;
 		xasprintf(cause, "%s: %s", cmd, strerror(errno));
@@ -672,7 +672,7 @@ window_pane_parse(struct window_pane *wp)
 		data = EVBUFFER_DATA(wp->event->input);
 		bufferevent_write(wp->pipe_event, data, new_size);
 	}
-	
+
 	input_parse(wp);
 
 	wp->pipe_off = EVBUFFER_LENGTH(wp->event->input);
diff --git a/xterm-keys.c b/xterm-keys.c
index a191471a..096489d8 100644
--- a/xterm-keys.c
+++ b/xterm-keys.c
@@ -1,4 +1,4 @@
-/* $Id: xterm-keys.c,v 1.4 2009-12-02 15:06:35 tcunha Exp $ */
+/* $Id: xterm-keys.c,v 1.5 2009-12-04 22:14:47 tcunha Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -27,11 +27,11 @@
  * character:
  *
  * 2 Shift
- * 3 Alt 
- * 4 Shift + Alt 
- * 5 Ctrl 
- * 6 Shift + Ctrl 
- * 7 Alt + Ctrl 
+ * 3 Alt
+ * 4 Shift + Alt
+ * 5 Ctrl
+ * 6 Shift + Ctrl
+ * 7 Alt + Ctrl
  * 8 Shift + Alt + Ctrl
  *
  * Rather than parsing them, just match against a table.
@@ -85,7 +85,7 @@ struct xterm_keys_entry xterm_keys_table[] = {
 	{ KEYC_DC,	"\033[3;_~" },
 };
 
-/* 
+/*
  * Match key against buffer, treating _ as a wildcard. Return -1 for no match,
  * 0 for match, 1 if the end of the buffer is reached (need more data).
  */
@@ -132,7 +132,7 @@ xterm_keys_modifiers(const char *template, const char *buf, size_t len)
 	case '7':
 		return (KEYC_ESCAPE|KEYC_CTRL);
 	case '8':
- 		return (KEYC_SHIFT|KEYC_ESCAPE|KEYC_CTRL);
+		return (KEYC_SHIFT|KEYC_ESCAPE|KEYC_CTRL);
 	}
 	return (0);
 }
@@ -206,7 +206,7 @@ xterm_keys_lookup(int key)
 	}
 	if (i == nitems(xterm_keys_table))
 		return (NULL);
-	
+
 	/* Copy the template and replace the modifier. */
 	out = xstrdup(entry->template);
 	out[strcspn(out, "_")] = '0' + modifiers;