Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'upstream' into experimental

* upstream:
  Import upstream snapshot from SVN r2670
  • Loading branch information...
commit c8d32cfb44bac004152f327f21c1a11e05f91521 2 parents c3deb11 + 0f2e336
Romain Francoise authored January 21, 2012
4  cmd-attach-session.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-attach-session.c 2553 2011-07-09 09:42:33Z tcunha $ */
  1
+/* $Id: cmd-attach-session.c 2665 2012-01-21 19:30:07Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -76,6 +76,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
76 76
 		ctx->curclient->session = s;
77 77
 		session_update_activity(s);
78 78
 		server_redraw_client(ctx->curclient);
  79
+		s->curw->flags &= ~WINLINK_ALERTFLAGS;
79 80
 	} else {
80 81
 		if (!(ctx->cmdclient->flags & CLIENT_TERMINAL)) {
81 82
 			ctx->error(ctx, "not a terminal");
@@ -104,6 +105,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
104 105
 		environ_update(update, &ctx->cmdclient->environ, &s->environ);
105 106
 
106 107
 		server_redraw_client(ctx->cmdclient);
  108
+		s->curw->flags &= ~WINLINK_ALERTFLAGS;
107 109
 	}
108 110
 	recalculate_sizes();
109 111
 	server_update_socket();
6  cmd-bind-key.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-bind-key.c 2553 2011-07-09 09:42:33Z tcunha $ */
  1
+/* $Id: cmd-bind-key.c 2670 2012-01-21 19:38:26Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -107,7 +107,7 @@ cmd_bind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key)
107 107
 
108 108
 	mtmp.key = key;
109 109
 	mtmp.mode = !!args_has(args, 'c');
110  
-	if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
  110
+	if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
111 111
 		mbind->cmd = cmd;
112 112
 		return (0);
113 113
 	}
@@ -115,6 +115,6 @@ cmd_bind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key)
115 115
 	mbind->key = mtmp.key;
116 116
 	mbind->mode = mtmp.mode;
117 117
 	mbind->cmd = cmd;
118  
-	SPLAY_INSERT(mode_key_tree, mtab->tree, mbind);
  118
+	RB_INSERT(mode_key_tree, mtab->tree, mbind);
119 119
 	return (0);
120 120
 }
6  cmd-capture-pane.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-capture-pane.c 2595 2011-09-21 16:34:34Z tcunha $ */
  1
+/* $Id: cmd-capture-pane.c 2651 2011-12-30 14:16:44Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net>
@@ -59,7 +59,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
59 59
 	buf = NULL;
60 60
 	len = 0;
61 61
 
62  
-	n = args_strtonum(args, 'S', SHRT_MIN, SHRT_MAX, &cause);
  62
+	n = args_strtonum(args, 'S', INT_MIN, SHRT_MAX, &cause);
63 63
 	if (cause != NULL) {
64 64
 		top = gd->hsize;
65 65
 		xfree(cause);
@@ -70,7 +70,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
70 70
 	if (top > gd->hsize + gd->sy - 1)
71 71
 		top = gd->hsize + gd->sy - 1;
72 72
 
73  
-	n = args_strtonum(args, 'E', SHRT_MIN, SHRT_MAX, &cause);
  73
+	n = args_strtonum(args, 'E', INT_MIN, SHRT_MAX, &cause);
74 74
 	if (cause != NULL) {
75 75
 		bottom = gd->hsize + gd->sy - 1;
76 76
 		xfree(cause);
12  cmd-list-keys.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-list-keys.c 2553 2011-07-09 09:42:33Z tcunha $ */
  1
+/* $Id: cmd-list-keys.c 2670 2012-01-21 19:38:26Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -54,9 +54,8 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
54 54
 		return (cmd_list_keys_table(self, ctx));
55 55
 
56 56
 	width = 0;
57  
-	*flags = '\0';
58 57
 
59  
-	SPLAY_FOREACH(bd, key_bindings, &key_bindings) {
  58
+	RB_FOREACH(bd, key_bindings, &key_bindings) {
60 59
 		key = key_string_lookup_key(bd->key & ~KEYC_PREFIX);
61 60
 		if (key == NULL)
62 61
 			continue;
@@ -73,11 +72,12 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
73 72
 			width = keywidth;
74 73
 	}
75 74
 
76  
-	SPLAY_FOREACH(bd, key_bindings, &key_bindings) {
  75
+	RB_FOREACH(bd, key_bindings, &key_bindings) {
77 76
 		key = key_string_lookup_key(bd->key & ~KEYC_PREFIX);
78 77
 		if (key == NULL)
79 78
 			continue;
80 79
 
  80
+		*flags = '\0';
81 81
 		if (!(bd->key & KEYC_PREFIX)) {
82 82
 			if (bd->can_repeat)
83 83
 				xsnprintf(flags, sizeof flags, "-rn ");
@@ -116,7 +116,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx)
116 116
 
117 117
 	width = 0;
118 118
 	any_mode = 0;
119  
-	SPLAY_FOREACH(mbind, mode_key_tree, mtab->tree) {
  119
+	RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
120 120
 		key = key_string_lookup_key(mbind->key);
121 121
 		if (key == NULL)
122 122
 			continue;
@@ -129,7 +129,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx)
129 129
 			width = keywidth;
130 130
 	}
131 131
 
132  
-	SPLAY_FOREACH(mbind, mode_key_tree, mtab->tree) {
  132
+	RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
133 133
 		key = key_string_lookup_key(mbind->key);
134 134
 		if (key == NULL)
135 135
 			continue;
5  cmd-new-window.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-new-window.c 2647 2011-12-09 16:37:29Z nicm $ */
  1
+/* $Id: cmd-new-window.c 2664 2012-01-20 21:21:32Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,7 +44,8 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
44 44
 	struct args	*args = self->args;
45 45
 	struct session	*s;
46 46
 	struct winlink	*wl;
47  
-	char		*cmd, *cwd, *cause;
  47
+	const char     	*cmd, *cwd;
  48
+	char		*cause;
48 49
 	int		 idx, last, detached;
49 50
 
50 51
 	if (args_has(args, 'a')) {
24  cmd-send-keys.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-send-keys.c 2553 2011-07-09 09:42:33Z tcunha $ */
  1
+/* $Id: cmd-send-keys.c 2666 2012-01-21 19:31:59Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -19,6 +19,7 @@
19 19
 #include <sys/types.h>
20 20
 
21 21
 #include <stdlib.h>
  22
+#include <string.h>
22 23
 
23 24
 #include "tmux.h"
24 25
 
@@ -30,8 +31,8 @@ int	cmd_send_keys_exec(struct cmd *, struct cmd_ctx *);
30 31
 
31 32
 const struct cmd_entry cmd_send_keys_entry = {
32 33
 	"send-keys", "send",
33  
-	"t:", 0, -1,
34  
-	"[-t target-pane] key ...",
  34
+	"Rt:", 0, -1,
  35
+	"[-R] [-t target-pane] key ...",
35 36
 	0,
36 37
 	NULL,
37 38
 	NULL,
@@ -44,12 +45,29 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
44 45
 	struct args		*args = self->args;
45 46
 	struct window_pane	*wp;
46 47
 	struct session		*s;
  48
+	struct input_ctx	*ictx;
47 49
 	const char		*str;
48 50
 	int			 i, key;
49 51
 
50 52
 	if (cmd_find_pane(ctx, args_get(args, 't'), &s, &wp) == NULL)
51 53
 		return (-1);
52 54
 
  55
+	if (args_has(args, 'R')) {
  56
+		ictx = &wp->ictx;
  57
+
  58
+		memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell);
  59
+		memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
  60
+		ictx->old_cx = 0;
  61
+		ictx->old_cy = 0;
  62
+
  63
+		if (wp->mode == NULL)
  64
+			screen_write_start(&ictx->ctx, wp, &wp->base);
  65
+		else
  66
+			screen_write_start(&ictx->ctx, NULL, &wp->base);
  67
+		screen_write_reset(&ictx->ctx);
  68
+		screen_write_stop(&ictx->ctx);
  69
+	}
  70
+
53 71
 	for (i = 0; i < args->argc; i++) {
54 72
 		str = args->argv[i];
55 73
 
15  cmd-send-prefix.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-send-prefix.c 2553 2011-07-09 09:42:33Z tcunha $ */
  1
+/* $Id: cmd-send-prefix.c 2669 2012-01-21 19:36:40Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,8 +28,8 @@ int	cmd_send_prefix_exec(struct cmd *, struct cmd_ctx *);
28 28
 
29 29
 const struct cmd_entry cmd_send_prefix_entry = {
30 30
 	"send-prefix", NULL,
31  
-	"t:", 0, 0,
32  
-	CMD_TARGET_PANE_USAGE,
  31
+	"2t:", 0, 0,
  32
+	"[-2] " CMD_TARGET_PANE_USAGE,
33 33
 	0,
34 34
 	NULL,
35 35
 	NULL,
@@ -42,13 +42,16 @@ cmd_send_prefix_exec(struct cmd *self, struct cmd_ctx *ctx)
42 42
 	struct args		*args = self->args;
43 43
 	struct session		*s;
44 44
 	struct window_pane	*wp;
45  
-	struct keylist		*keylist;
  45
+	int			 key;
46 46
 
47 47
 	if (cmd_find_pane(ctx, args_get(args, 't'), &s, &wp) == NULL)
48 48
 		return (-1);
49 49
 
50  
-	keylist = options_get_data(&s->options, "prefix");
51  
-	window_pane_key(wp, s, ARRAY_FIRST(keylist));
  50
+	if (args_has(args, '2'))
  51
+		key = options_get_number(&s->options, "prefix2");
  52
+	else
  53
+		key = options_get_number(&s->options, "prefix");
  54
+	window_pane_key(wp, s, key);
52 55
 
53 56
 	return (0);
54 57
 }
36  cmd-set-option.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-set-option.c 2553 2011-07-09 09:42:33Z tcunha $ */
  1
+/* $Id: cmd-set-option.c 2669 2012-01-21 19:36:40Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -45,7 +45,7 @@ struct options_entry *cmd_set_option_string(struct cmd *, struct cmd_ctx *,
45 45
 struct options_entry *cmd_set_option_number(struct cmd *, struct cmd_ctx *,
46 46
 	    const struct options_table_entry *, struct options *,
47 47
 	    const char *);
48  
-struct options_entry *cmd_set_option_keys(struct cmd *, struct cmd_ctx *,
  48
+struct options_entry *cmd_set_option_key(struct cmd *, struct cmd_ctx *,
49 49
 	    const struct options_table_entry *, struct options *,
50 50
 	    const char *);
51 51
 struct options_entry *cmd_set_option_colour(struct cmd *, struct cmd_ctx *,
@@ -236,8 +236,8 @@ cmd_set_option_set(struct cmd *self, struct cmd_ctx *ctx,
236 236
 	case OPTIONS_TABLE_NUMBER:
237 237
 		o = cmd_set_option_number(self, ctx, oe, oo, value);
238 238
 		break;
239  
-	case OPTIONS_TABLE_KEYS:
240  
-		o = cmd_set_option_keys(self, ctx, oe, oo, value);
  239
+	case OPTIONS_TABLE_KEY:
  240
+		o = cmd_set_option_key(self, ctx, oe, oo, value);
241 241
 		break;
242 242
 	case OPTIONS_TABLE_COLOUR:
243 243
 		o = cmd_set_option_colour(self, ctx, oe, oo, value);
@@ -298,31 +298,19 @@ cmd_set_option_number(unused struct cmd *self, struct cmd_ctx *ctx,
298 298
 	return (options_set_number(oo, oe->name, ll));
299 299
 }
300 300
 
301  
-/* Set a keys option. */
  301
+/* Set a key option. */
302 302
 struct options_entry *
303  
-cmd_set_option_keys(unused struct cmd *self, struct cmd_ctx *ctx,
  303
+cmd_set_option_key(unused struct cmd *self, struct cmd_ctx *ctx,
304 304
     const struct options_table_entry *oe, struct options *oo, const char *value)
305 305
 {
306  
-	struct keylist	*keylist;
307  
-	char		*copy, *ptr, *s;
308  
-	int		 key;
309  
-
310  
-	keylist = xmalloc(sizeof *keylist);
311  
-	ARRAY_INIT(keylist);
312  
-
313  
-	ptr = copy = xstrdup(value);
314  
-	while ((s = strsep(&ptr, ",")) != NULL) {
315  
-		if ((key = key_string_lookup_string(s)) == KEYC_NONE) {
316  
-			ctx->error(ctx, "unknown key: %s", s);
317  
-			xfree(copy);
318  
-			xfree(keylist);
319  
-			return (NULL);
320  
-		}
321  
-		ARRAY_ADD(keylist, key);
  306
+	int	key;
  307
+
  308
+	if ((key = key_string_lookup_string(value)) == KEYC_NONE) {
  309
+		ctx->error(ctx, "bad key: %s", value);
  310
+		return (NULL);
322 311
 	}
323  
-	xfree(copy);
324 312
 
325  
-	return (options_set_data(oo, oe->name, keylist, xfree));
  313
+	return (options_set_number(oo, oe->name, key));
326 314
 }
327 315
 
328 316
 /* Set a colour option. */
6  cmd-split-window.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-split-window.c 2647 2011-12-09 16:37:29Z nicm $ */
  1
+/* $Id: cmd-split-window.c 2664 2012-01-20 21:21:32Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -57,8 +57,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
57 57
 	struct window		*w;
58 58
 	struct window_pane	*wp, *new_wp = NULL;
59 59
 	struct environ		 env;
60  
-	char		 	*cmd, *cwd, *cause, *new_cause;
61  
-	const char		*shell;
  60
+	const char	       	*cmd, *cwd, *shell;
  61
+	char			*cause, *new_cause;
62 62
 	u_int			 hlimit, paneidx;
63 63
 	int			 size, percentage;
64 64
 	enum layout_type	 type;
3  cmd-switch-client.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-switch-client.c 2582 2011-08-21 12:38:55Z tcunha $ */
  1
+/* $Id: cmd-switch-client.c 2665 2012-01-21 19:30:07Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -108,6 +108,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
108 108
 	recalculate_sizes();
109 109
 	server_check_unattached();
110 110
 	server_redraw_client(c);
  111
+	s->curw->flags &= ~WINLINK_ALERTFLAGS;
111 112
 
112 113
 	return (0);
113 114
 }
10  cmd-unbind-key.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd-unbind-key.c 2580 2011-08-21 12:36:43Z tcunha $ */
  1
+/* $Id: cmd-unbind-key.c 2670 2012-01-21 19:38:26Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -57,8 +57,8 @@ cmd_unbind_key_exec(struct cmd *self, unused struct cmd_ctx *ctx)
57 57
 	int			 key;
58 58
 
59 59
 	if (args_has(args, 'a')) {
60  
-		while (!SPLAY_EMPTY(&key_bindings)) {
61  
-			bd = SPLAY_ROOT(&key_bindings);
  60
+		while (!RB_EMPTY(&key_bindings)) {
  61
+			bd = RB_ROOT(&key_bindings);
62 62
 			key_bindings_remove(bd->key);
63 63
 		}
64 64
 		return (0);
@@ -95,8 +95,8 @@ cmd_unbind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key)
95 95
 
96 96
 	mtmp.key = key;
97 97
 	mtmp.mode = !!args_has(args, 'c');
98  
-	if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
99  
-		SPLAY_REMOVE(mode_key_tree, mtab->tree, mbind);
  98
+	if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
  99
+		RB_REMOVE(mode_key_tree, mtab->tree, mbind);
100 100
 		xfree(mbind);
101 101
 	}
102 102
 	return (0);
13  cmd.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: cmd.c 2647 2011-12-09 16:37:29Z nicm $ */
  1
+/* $Id: cmd.c 2664 2012-01-20 21:21:32Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1214,17 +1214,24 @@ cmd_template_replace(char *template, const char *s, int idx)
1214 1214
 }
1215 1215
 
1216 1216
 /* Return the default path for a new pane. */
1217  
-char *
  1217
+const char *
1218 1218
 cmd_get_default_path(struct cmd_ctx *ctx)
1219 1219
 {
1220  
-	char			*cwd;
  1220
+	const char		*cwd;
1221 1221
 	struct session		*s;
1222 1222
 	struct window_pane	*wp;
  1223
+	struct environ_entry	*envent;
1223 1224
 
1224 1225
 	if ((s = cmd_current_session(ctx, 0)) == NULL)
1225 1226
 		return (NULL);
1226 1227
 
1227 1228
 	cwd = options_get_string(&s->options, "default-path");
  1229
+	if ((cwd[0] == '~' && cwd[1] == '\0') || !strcmp(cwd, "$HOME")) {
  1230
+		envent = environ_find(&global_environ, "HOME");
  1231
+		if (envent != NULL && *envent->value != '\0')
  1232
+			return envent->value;
  1233
+		cwd = "";
  1234
+	}
1228 1235
 	if (*cwd == '\0') {
1229 1236
 		if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL)
1230 1237
 			return (ctx->cmdclient->cwd);
42  colour.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: colour.c 2584 2011-08-25 21:11:16Z tcunha $ */
  1
+/* $Id: colour.c 2668 2012-01-21 19:33:45Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -170,6 +170,22 @@ colour_tostring(int c)
170 170
 		return ("white");
171 171
 	case 8:
172 172
 		return ("default");
  173
+	case 90:
  174
+		return ("brightblack");
  175
+	case 91:
  176
+		return ("brightred");
  177
+	case 92:
  178
+		return ("brightgreen");
  179
+	case 93:
  180
+		return ("brightyellow");
  181
+	case 94:
  182
+		return ("brightblue");
  183
+	case 95:
  184
+		return ("brightmagenta");
  185
+	case 96:
  186
+		return ("brightcyan");
  187
+	case 97:
  188
+		return ("brightwhite");
173 189
 	}
174 190
 	return (NULL);
175 191
 }
@@ -219,6 +235,30 @@ colour_fromstring(const char *s)
219 235
 		return (7);
220 236
 	if (strcasecmp(s, "default") == 0 || (s[0] == '8' && s[1] == '\0'))
221 237
 		return (8);
  238
+	if (strcasecmp(s, "brightblack") == 0 ||
  239
+	    (s[0] == '9' && s[1] == '0' && s[1] == '\0'))
  240
+		return (90);
  241
+	if (strcasecmp(s, "brightred") == 0 ||
  242
+	    (s[0] == '9' && s[1] == '1' && s[1] == '\0'))
  243
+		return (91);
  244
+	if (strcasecmp(s, "brightgreen") == 0 ||
  245
+	    (s[0] == '9' && s[1] == '2' && s[1] == '\0'))
  246
+		return (92);
  247
+	if (strcasecmp(s, "brightyellow") == 0 ||
  248
+	    (s[0] == '9' && s[1] == '3' && s[1] == '\0'))
  249
+		return (93);
  250
+	if (strcasecmp(s, "brightblue") == 0 ||
  251
+	    (s[0] == '9' && s[1] == '4' && s[1] == '\0'))
  252
+		return (94);
  253
+	if (strcasecmp(s, "brightmagenta") == 0 ||
  254
+	    (s[0] == '9' && s[1] == '5' && s[1] == '\0'))
  255
+		return (95);
  256
+	if (strcasecmp(s, "brightcyan") == 0 ||
  257
+	    (s[0] == '9' && s[1] == '6' && s[1] == '\0'))
  258
+		return (96);
  259
+	if (strcasecmp(s, "brightwhite") == 0 ||
  260
+	    (s[0] == '9' && s[1] == '7' && s[1] == '\0'))
  261
+		return (97);
222 262
 	return (-1);
223 263
 }
224 264
 
43  input.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: input.c 2621 2011-10-23 15:10:22Z tcunha $ */
  1
+/* $Id: input.c 2668 2012-01-21 19:33:45Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -119,6 +119,8 @@ const struct input_table_entry input_esc_table[] = {
119 119
 /* Control (CSI) commands. */
120 120
 enum input_csi_type {
121 121
 	INPUT_CSI_CBT,
  122
+	INPUT_CSI_CNL,
  123
+	INPUT_CSI_CPL,
122 124
 	INPUT_CSI_CUB,
123 125
 	INPUT_CSI_CUD,
124 126
 	INPUT_CSI_CUF,
@@ -135,8 +137,10 @@ enum input_csi_type {
135 137
 	INPUT_CSI_HPA,
136 138
 	INPUT_CSI_ICH,
137 139
 	INPUT_CSI_IL,
  140
+	INPUT_CSI_RCP,
138 141
 	INPUT_CSI_RM,
139 142
 	INPUT_CSI_RM_PRIVATE,
  143
+	INPUT_CSI_SCP,
140 144
 	INPUT_CSI_SGR,
141 145
 	INPUT_CSI_SM,
142 146
 	INPUT_CSI_SM_PRIVATE,
@@ -151,6 +155,8 @@ const struct input_table_entry input_csi_table[] = {
151 155
 	{ 'B', "",  INPUT_CSI_CUD },
152 156
 	{ 'C', "",  INPUT_CSI_CUF },
153 157
 	{ 'D', "",  INPUT_CSI_CUB },
  158
+	{ 'E', "",  INPUT_CSI_CNL },
  159
+	{ 'F', "",  INPUT_CSI_CPL },
154 160
 	{ 'G', "",  INPUT_CSI_HPA },
155 161
 	{ 'H', "",  INPUT_CSI_CUP },
156 162
 	{ 'J', "",  INPUT_CSI_ED },
@@ -171,6 +177,8 @@ const struct input_table_entry input_csi_table[] = {
171 177
 	{ 'n', "",  INPUT_CSI_DSR },
172 178
 	{ 'q', " ", INPUT_CSI_DECSCUSR },
173 179
 	{ 'r', "",  INPUT_CSI_DECSTBM },
  180
+	{ 's', "",  INPUT_CSI_SCP },
  181
+	{ 'u', "",  INPUT_CSI_RCP },
174 182
 };
175 183
 
176 184
 /* Input transition. */
@@ -970,17 +978,7 @@ input_esc_dispatch(struct input_ctx *ictx)
970 978
 		ictx->old_cx = 0;
971 979
 		ictx->old_cy = 0;
972 980
 
973  
-		screen_reset_tabs(sctx->s);
974  
-
975  
-		screen_write_scrollregion(sctx, 0, screen_size_y(sctx->s) - 1);
976  
-
977  
-		screen_write_insertmode(sctx, 0);
978  
-		screen_write_kcursormode(sctx, 0);
979  
-		screen_write_kkeypadmode(sctx, 0);
980  
-		screen_write_mousemode_off(sctx);
981  
-
982  
-		screen_write_clearscreen(sctx);
983  
-		screen_write_cursormove(sctx, 0, 0);
  981
+		screen_write_reset(sctx);
984 982
 		break;
985 983
 	case INPUT_ESC_IND:
986 984
 		screen_write_linefeed(sctx, 0);
@@ -1081,6 +1079,14 @@ input_csi_dispatch(struct input_ctx *ictx)
1081 1079
 	case INPUT_CSI_CUU:
1082 1080
 		screen_write_cursorup(sctx, input_get(ictx, 0, 1, 1));
1083 1081
 		break;
  1082
+	case INPUT_CSI_CNL:
  1083
+		screen_write_carriagereturn(sctx);
  1084
+		screen_write_cursordown(sctx, input_get(ictx, 0, 1, 1));
  1085
+		break;
  1086
+	case INPUT_CSI_CPL:
  1087
+		screen_write_carriagereturn(sctx);
  1088
+		screen_write_cursorup(sctx, input_get(ictx, 0, 1, 1));
  1089
+		break;
1084 1090
 	case INPUT_CSI_DA:
1085 1091
 		switch (input_get(ictx, 0, 0, 0)) {
1086 1092
 		case 0:
@@ -1168,6 +1174,10 @@ input_csi_dispatch(struct input_ctx *ictx)
1168 1174
 	case INPUT_CSI_IL:
1169 1175
 		screen_write_insertline(sctx, input_get(ictx, 0, 1, 1));
1170 1176
 		break;
  1177
+	case INPUT_CSI_RCP:
  1178
+		memcpy(&ictx->cell, &ictx->old_cell, sizeof ictx->cell);
  1179
+		screen_write_cursormove(sctx, ictx->old_cx, ictx->old_cy);
  1180
+		break;
1171 1181
 	case INPUT_CSI_RM:
1172 1182
 		switch (input_get(ictx, 0, 0, -1)) {
1173 1183
 		case 4:		/* IRM */
@@ -1207,6 +1217,11 @@ input_csi_dispatch(struct input_ctx *ictx)
1207 1217
 			break;
1208 1218
 		}
1209 1219
 		break;
  1220
+	case INPUT_CSI_SCP:
  1221
+		memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
  1222
+		ictx->old_cx = s->cx;
  1223
+		ictx->old_cy = s->cy;
  1224
+		break;
1210 1225
 	case INPUT_CSI_SGR:
1211 1226
 		input_csi_dispatch_sgr(ictx);
1212 1227
 		break;
@@ -1421,7 +1436,7 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
1421 1436
 		case 106:
1422 1437
 		case 107:
1423 1438
 			gc->flags &= ~GRID_FLAG_BG256;
1424  
-			gc->bg = n;
  1439
+			gc->bg = n - 10;
1425 1440
 			break;
1426 1441
 		}
1427 1442
 	}
@@ -1533,6 +1548,8 @@ input_exit_rename(struct input_ctx *ictx)
1533 1548
 {
1534 1549
 	if (ictx->flags & INPUT_DISCARD)
1535 1550
 		return;
  1551
+	if (!options_get_number(&ictx->wp->window->options, "allow-rename"))
  1552
+		return;
1536 1553
 	log_debug("%s: \"%s\"", __func__, ictx->input_buf);
1537 1554
 
1538 1555
 	xfree(ictx->wp->window->name);
20  key-bindings.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: key-bindings.c 2553 2011-07-09 09:42:33Z tcunha $ */
  1
+/* $Id: key-bindings.c 2670 2012-01-21 19:38:26Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -24,7 +24,7 @@
24 24
 
25 25
 #include "tmux.h"
26 26
 
27  
-SPLAY_GENERATE(key_bindings, key_binding, entry, key_bindings_cmp);
  27
+RB_GENERATE(key_bindings, key_binding, entry, key_bindings_cmp);
28 28
 
29 29
 struct key_bindings	key_bindings;
30 30
 struct key_bindings	dead_key_bindings;
@@ -52,7 +52,7 @@ key_bindings_lookup(int key)
52 52
 	struct key_binding	bd;
53 53
 
54 54
 	bd.key = key;
55  
-	return (SPLAY_FIND(key_bindings, &key_bindings, &bd));
  55
+	return (RB_FIND(key_bindings, &key_bindings, &bd));
56 56
 }
57 57
 
58 58
 void
@@ -64,7 +64,7 @@ key_bindings_add(int key, int can_repeat, struct cmd_list *cmdlist)
64 64
 
65 65
 	bd = xmalloc(sizeof *bd);
66 66
 	bd->key = key;
67  
-	SPLAY_INSERT(key_bindings, &key_bindings, bd);
  67
+	RB_INSERT(key_bindings, &key_bindings, bd);
68 68
 
69 69
 	bd->can_repeat = can_repeat;
70 70
 	bd->cmdlist = cmdlist;
@@ -77,8 +77,8 @@ key_bindings_remove(int key)
77 77
 
78 78
 	if ((bd = key_bindings_lookup(key)) == NULL)
79 79
 		return;
80  
-	SPLAY_REMOVE(key_bindings, &key_bindings, bd);
81  
-	SPLAY_INSERT(key_bindings, &dead_key_bindings, bd);
  80
+	RB_REMOVE(key_bindings, &key_bindings, bd);
  81
+	RB_INSERT(key_bindings, &dead_key_bindings, bd);
82 82
 }
83 83
 
84 84
 void
@@ -86,9 +86,9 @@ key_bindings_clean(void)
86 86
 {
87 87
 	struct key_binding	*bd;
88 88
 
89  
-	while (!SPLAY_EMPTY(&dead_key_bindings)) {
90  
-		bd = SPLAY_ROOT(&dead_key_bindings);
91  
-		SPLAY_REMOVE(key_bindings, &dead_key_bindings, bd);
  89
+	while (!RB_EMPTY(&dead_key_bindings)) {
  90
+		bd = RB_ROOT(&dead_key_bindings);
  91
+		RB_REMOVE(key_bindings, &dead_key_bindings, bd);
92 92
 		cmd_list_free(bd->cmdlist);
93 93
 		xfree(bd);
94 94
 	}
@@ -179,7 +179,7 @@ key_bindings_init(void)
179 179
 	struct cmd	*cmd;
180 180
 	struct cmd_list	*cmdlist;
181 181
 
182  
-	SPLAY_INIT(&key_bindings);
  182
+	RB_INIT(&key_bindings);
183 183
 
184 184
 	for (i = 0; i < nitems(table); i++) {
185 185
 		cmdlist = xmalloc(sizeof *cmdlist);
6  key-string.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: key-string.c 2622 2011-10-23 15:11:09Z tcunha $ */
  1
+/* $Id: key-string.c 2669 2012-01-21 19:36:40Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -188,6 +188,10 @@ key_string_lookup_key(int key)
188 188
 
189 189
 	*out = '\0';
190 190
 
  191
+	/* Handle no key. */
  192
+	if (key == KEYC_NONE)
  193
+		return ("none");
  194
+
191 195
 	/*
192 196
 	 * Special case: display C-@ as C-Space. Could do this below in
193 197
 	 * the (key >= 0 && key <= 32), but this way we let it be found
16  mode-key.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: mode-key.c 2646 2011-12-06 18:50:26Z tcunha $ */
  1
+/* $Id: mode-key.c 2670 2012-01-21 19:38:26Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -54,9 +54,12 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
54 54
 	{ MODEKEYEDIT_ENTER, "enter" },
55 55
 	{ MODEKEYEDIT_HISTORYDOWN, "history-down" },
56 56
 	{ MODEKEYEDIT_HISTORYUP, "history-up" },
  57
+	{ MODEKEYEDIT_NEXTSPACE, "next-space" },
  58
+	{ MODEKEYEDIT_NEXTSPACEEND, "next-space-end" },
57 59
 	{ MODEKEYEDIT_NEXTWORD, "next-word" },
58 60
 	{ MODEKEYEDIT_NEXTWORDEND, "next-word-end" },
59 61
 	{ MODEKEYEDIT_PASTE, "paste" },
  62
+	{ MODEKEYEDIT_PREVIOUSSPACE, "previous-space" },
60 63
 	{ MODEKEYEDIT_PREVIOUSWORD, "previous-word" },
61 64
 	{ MODEKEYEDIT_STARTOFLINE, "start-of-line" },
62 65
 	{ MODEKEYEDIT_SWITCHMODE, "switch-mode" },
@@ -148,7 +151,10 @@ const struct mode_key_entry mode_key_vi_edit[] = {
148 151
 
149 152
 	{ '$',			1, MODEKEYEDIT_ENDOFLINE },
150 153
 	{ '0',			1, MODEKEYEDIT_STARTOFLINE },
  154
+	{ 'B',			1, MODEKEYEDIT_PREVIOUSSPACE },
151 155
 	{ 'D',			1, MODEKEYEDIT_DELETETOENDOFLINE },
  156
+	{ 'E',			1, MODEKEYEDIT_NEXTSPACEEND },
  157
+	{ 'W',			1, MODEKEYEDIT_NEXTSPACE },
152 158
 	{ 'X',			1, MODEKEYEDIT_BACKSPACE },
153 159
 	{ '\003' /* C-c */,	1, MODEKEYEDIT_CANCEL },
154 160
 	{ '\010' /* C-h */, 	1, MODEKEYEDIT_BACKSPACE },
@@ -406,7 +412,7 @@ const struct mode_key_table mode_key_tables[] = {
406 412
 	{ NULL, NULL, NULL, NULL }
407 413
 };
408 414
 
409  
-SPLAY_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
  415
+RB_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
410 416
 
411 417
 int
412 418
 mode_key_cmp(struct mode_key_binding *mbind1, struct mode_key_binding *mbind2)
@@ -456,13 +462,13 @@ mode_key_init_trees(void)
456 462
 	struct mode_key_binding		*mbind;
457 463
 
458 464
 	for (mtab = mode_key_tables; mtab->name != NULL; mtab++) {
459  
-		SPLAY_INIT(mtab->tree);
  465
+		RB_INIT(mtab->tree);
460 466
 		for (ment = mtab->table; ment->mode != -1; ment++) {
461 467
 			mbind = xmalloc(sizeof *mbind);
462 468
 			mbind->key = ment->key;
463 469
 			mbind->mode = ment->mode;
464 470
 			mbind->cmd = ment->cmd;
465  
-			SPLAY_INSERT(mode_key_tree, mtab->tree, mbind);
  471
+			RB_INSERT(mode_key_tree, mtab->tree, mbind);
466 472
 		}
467 473
 	}
468 474
 }
@@ -481,7 +487,7 @@ mode_key_lookup(struct mode_key_data *mdata, int key)
481 487
 
482 488
 	mtmp.key = key;
483 489
 	mtmp.mode = mdata->mode;
484  
-	if ((mbind = SPLAY_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) {
  490
+	if ((mbind = RB_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) {
485 491
 		if (mdata->mode != 0)
486 492
 			return (MODEKEY_NONE);
487 493
 		return (MODEKEY_OTHER);
68  options-table.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: options-table.c 2640 2011-11-25 13:33:04Z tcunha $ */
  1
+/* $Id: options-table.c 2669 2012-01-21 19:36:40Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -261,8 +261,13 @@ const struct options_table_entry session_options_table[] = {
261 261
 	},
262 262
 
263 263
 	{ .name = "prefix",
264  
-	  .type = OPTIONS_TABLE_KEYS,
265  
-	  /* set in main() */
  264
+	  .type = OPTIONS_TABLE_KEY,
  265
+	  .default_num = '\002',
  266
+	},
  267
+
  268
+	{ .name = "prefix2",
  269
+	  .type = OPTIONS_TABLE_KEY,
  270
+	  .default_num = KEYC_NONE,
266 271
 	},
267 272
 
268 273
 	{ .name = "repeat-time",
@@ -435,6 +440,11 @@ const struct options_table_entry window_options_table[] = {
435 440
 	  .default_num = 0
436 441
 	},
437 442
 
  443
+	{ .name = "allow-rename",
  444
+	  .type = OPTIONS_TABLE_FLAG,
  445
+	  .default_num = 1
  446
+	},
  447
+
438 448
 	{ .name = "alternate-screen",
439 449
 	  .type = OPTIONS_TABLE_FLAG,
440 450
 	  .default_num = 1
@@ -564,17 +574,47 @@ const struct options_table_entry window_options_table[] = {
564 574
 	  .default_num = 0 /* overridden in main() */
565 575
 	},
566 576
 
567  
-	{ .name = "window-status-alert-attr",
  577
+	{ .name = "window-status-bell-attr",
  578
+	  .type = OPTIONS_TABLE_ATTRIBUTES,
  579
+	  .default_num = GRID_ATTR_REVERSE
  580
+	},
  581
+
  582
+	{ .name = "window-status-bell-bg",
  583
+	  .type = OPTIONS_TABLE_COLOUR,
  584
+	  .default_num = 8
  585
+	},
  586
+
  587
+	{ .name = "window-status-bell-fg",
  588
+	  .type = OPTIONS_TABLE_COLOUR,
  589
+	  .default_num = 8
  590
+	},
  591
+
  592
+	{ .name = "window-status-content-attr",
  593
+	  .type = OPTIONS_TABLE_ATTRIBUTES,
  594
+	  .default_num = GRID_ATTR_REVERSE
  595
+	},
  596
+
  597
+	{ .name = "window-status-content-bg",
  598
+	  .type = OPTIONS_TABLE_COLOUR,
  599
+	  .default_num = 8
  600
+	},
  601
+
  602
+	{ .name = "window-status-content-fg",
  603
+	  .type = OPTIONS_TABLE_COLOUR,
  604
+	  .default_num = 8
  605
+	},
  606
+
  607
+	{ .name = "window-status-activity-attr",
568 608
 	  .type = OPTIONS_TABLE_ATTRIBUTES,
569 609
 	  .default_num = GRID_ATTR_REVERSE
570 610
 	},
571 611
 
572  
-	{ .name = "window-status-alert-bg",
  612
+	{ .name = "window-status-activity-bg",
573 613
 	  .type = OPTIONS_TABLE_COLOUR,
574 614
 	  .default_num = 8
575 615
 	},
576 616
 
577  
-	{ .name = "window-status-alert-fg",
  617
+	{ .name = "window-status-activity-fg",
578 618
 	  .type = OPTIONS_TABLE_COLOUR,
579 619
 	  .default_num = 8
580 620
 	},
@@ -647,10 +687,8 @@ const char *
647 687
 options_table_print_entry(
648 688
     const struct options_table_entry *oe, struct options_entry *o)
649 689
 {
650  
-	static char				 out[BUFSIZ];
651  
-	const char				*s;
652  
-	struct keylist				*keylist;
653  
-	u_int					 i;
  690
+	static char	 out[BUFSIZ];
  691
+	const char	*s;
654 692
 
655 693
 	*out = '\0';
656 694
 	switch (oe->type) {
@@ -660,14 +698,8 @@ options_table_print_entry(
660 698
 	case OPTIONS_TABLE_NUMBER:
661 699
 		xsnprintf(out, sizeof out, "%lld", o->num);
662 700
 		break;
663  
-	case OPTIONS_TABLE_KEYS:
664  
-		keylist = o->data;
665  
-		for (i = 0; i < ARRAY_LENGTH(keylist); i++) {
666  
-			s = key_string_lookup_key(ARRAY_ITEM(keylist, i));
667  
-			strlcat(out, s, sizeof out);
668  
-			if (i != ARRAY_LENGTH(keylist) - 1)
669  
-				strlcat(out, ",", sizeof out);
670  
-		}
  701
+	case OPTIONS_TABLE_KEY:
  702
+		xsnprintf(out, sizeof out, "%s", key_string_lookup_key(o->num));
671 703
 		break;
672 704
 	case OPTIONS_TABLE_COLOUR:
673 705
 		s = colour_tostring(o->num);
65  options.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: options.c 2553 2011-07-09 09:42:33Z tcunha $ */
  1
+/* $Id: options.c 2670 2012-01-21 19:38:26Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,7 +28,7 @@
28 28
  * a splay tree.
29 29
  */
30 30
 
31  
-SPLAY_GENERATE(options_tree, options_entry, entry, options_cmp);
  31
+RB_GENERATE(options_tree, options_entry, entry, options_cmp);
32 32
 
33 33
 int
34 34
 options_cmp(struct options_entry *o1, struct options_entry *o2)
@@ -39,7 +39,7 @@ options_cmp(struct options_entry *o1, struct options_entry *o2)
39 39
 void
40 40
 options_init(struct options *oo, struct options *parent)
41 41
 {
42  
-	SPLAY_INIT(&oo->tree);
  42
+	RB_INIT(&oo->tree);
43 43
 	oo->parent = parent;
44 44
 }
45 45
 
@@ -48,14 +48,12 @@ options_free(struct options *oo)
48 48
 {
49 49
 	struct options_entry	*o;
50 50
 
51  
-	while (!SPLAY_EMPTY(&oo->tree)) {
52  
-		o = SPLAY_ROOT(&oo->tree);
53  
-		SPLAY_REMOVE(options_tree, &oo->tree, o);
  51
+	while (!RB_EMPTY(&oo->tree)) {
  52
+		o = RB_ROOT(&oo->tree);
  53
+		RB_REMOVE(options_tree, &oo->tree, o);
54 54
 		xfree(o->name);
55 55
 		if (o->type == OPTIONS_STRING)
56 56
 			xfree(o->str);
57  
-		else if (o->type == OPTIONS_DATA)
58  
-			o->freefn(o->data);
59 57
 		xfree(o);
60 58
 	}
61 59
 }
@@ -66,7 +64,7 @@ options_find1(struct options *oo, const char *name)
66 64
 	struct options_entry	p;
67 65
 
68 66
 	p.name = (char *) name;
69  
-	return (SPLAY_FIND(options_tree, &oo->tree, &p));
  67
+	return (RB_FIND(options_tree, &oo->tree, &p));
70 68
 }
71 69
 
72 70
 struct options_entry *
@@ -75,12 +73,12 @@ options_find(struct options *oo, const char *name)
75 73
 	struct options_entry	*o, p;
76 74
 
77 75
 	p.name = (char *) name;
78  
-	o = SPLAY_FIND(options_tree, &oo->tree, &p);
  76
+	o = RB_FIND(options_tree, &oo->tree, &p);
79 77
 	while (o == NULL) {
80 78
 		oo = oo->parent;
81 79
 		if (oo == NULL)
82 80
 			break;
83  
-		o = SPLAY_FIND(options_tree, &oo->tree, &p);
  81
+		o = RB_FIND(options_tree, &oo->tree, &p);
84 82
 	}
85 83
 	return (o);
86 84
 }
@@ -93,12 +91,10 @@ options_remove(struct options *oo, const char *name)
93 91
 	if ((o = options_find1(oo, name)) == NULL)
94 92
 		return;
95 93
 
96  
-	SPLAY_REMOVE(options_tree, &oo->tree, o);
  94
+	RB_REMOVE(options_tree, &oo->tree, o);
97 95
 	xfree(o->name);
98 96
 	if (o->type == OPTIONS_STRING)
99 97
 		xfree(o->str);
100  
-	else if (o->type == OPTIONS_DATA)
101  
-		o->freefn(o->data);
102 98
 	xfree(o);
103 99
 }
104 100
 
@@ -111,11 +107,9 @@ options_set_string(struct options *oo, const char *name, const char *fmt, ...)
111 107
 	if ((o = options_find1(oo, name)) == NULL) {
112 108
 		o = xmalloc(sizeof *o);
113 109
 		o->name = xstrdup(name);
114  
-		SPLAY_INSERT(options_tree, &oo->tree, o);
  110
+		RB_INSERT(options_tree, &oo->tree, o);
115 111
 	} else if (o->type == OPTIONS_STRING)
116 112
 		xfree(o->str);
117  
-	else if (o->type == OPTIONS_DATA)
118  
-		o->freefn(o->data);
119 113
 
120 114
 	va_start(ap, fmt);
121 115
 	o->type = OPTIONS_STRING;
@@ -144,11 +138,9 @@ options_set_number(struct options *oo, const char *name, long long value)
144 138
 	if ((o = options_find1(oo, name)) == NULL) {
145 139
 		o = xmalloc(sizeof *o);
146 140
 		o->name = xstrdup(name);
147  
-		SPLAY_INSERT(options_tree, &oo->tree, o);
  141
+		RB_INSERT(options_tree, &oo->tree, o);
148 142
 	} else if (o->type == OPTIONS_STRING)
149 143
 		xfree(o->str);
150  
-	else if (o->type == OPTIONS_DATA)
151  
-		o->freefn(o->data);
152 144
 
153 145
 	o->type = OPTIONS_NUMBER;
154 146
 	o->num = value;
@@ -166,36 +158,3 @@ options_get_number(struct options *oo, const char *name)
166 158
 		fatalx("option not a number");
167 159
 	return (o->num);
168 160
 }
169  
-
170  
-struct options_entry *
171  
-options_set_data(
172  
-    struct options *oo, const char *name, void *value, void (*freefn)(void *))
173  
-{
174  
-	struct options_entry	*o;
175  
-
176  
-	if ((o = options_find1(oo, name)) == NULL) {
177  
-		o = xmalloc(sizeof *o);
178  
-		o->name = xstrdup(name);
179  
-		SPLAY_INSERT(options_tree, &oo->tree, o);
180  
-	} else if (o->type == OPTIONS_STRING)
181  
-		xfree(o->str);
182  
-	else if (o->type == OPTIONS_DATA)
183  
-		o->freefn(o->data);
184  
-
185  
-	o->type = OPTIONS_DATA;
186  
-	o->data = value;
187  
-	o->freefn = freefn;
188  
-	return (o);
189  
-}
190  
-
191  
-void *
192  
-options_get_data(struct options *oo, const char *name)
193  
-{
194  
-	struct options_entry	*o;
195  
-
196  
-	if ((o = options_find(oo, name)) == NULL)
197  
-		fatalx("missing option");
198  
-	if (o->type != OPTIONS_DATA)
199  
-		fatalx("option not data");
200  
-	return (o->data);
201  
-}
20  screen-write.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: screen-write.c 2621 2011-10-23 15:10:22Z tcunha $ */
  1
+/* $Id: screen-write.c 2666 2012-01-21 19:31:59Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -46,6 +46,24 @@ screen_write_stop(unused struct screen_write_ctx *ctx)
46 46
 {
47 47
 }
48 48
 
  49
+
  50
+/* Reset screen state. */
  51
+void
  52
+screen_write_reset(struct screen_write_ctx *ctx)
  53
+{
  54
+	screen_reset_tabs(ctx->s);
  55
+
  56
+	screen_write_scrollregion(ctx, 0, screen_size_y(ctx->s) - 1);
  57
+
  58
+	screen_write_insertmode(ctx, 0);
  59
+	screen_write_kcursormode(ctx, 0);
  60
+	screen_write_kkeypadmode(ctx, 0);
  61
+	screen_write_mousemode_off(ctx);
  62
+
  63
+	screen_write_clearscreen(ctx);
  64
+	screen_write_cursormove(ctx, 0, 0);
  65
+}
  66
+
49 67
 /* Write character. */
50 68
 void
51 69
 screen_write_putc(
20  server-client.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: server-client.c 2583 2011-08-21 12:39:34Z tcunha $ */
  1
+/* $Id: server-client.c 2669 2012-01-21 19:36:40Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -272,9 +272,7 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
272 272
 	struct options		*oo;
273 273
 	struct timeval		 tv;
274 274
 	struct key_binding	*bd;
275  
-	struct keylist		*keylist;
276 275
 	int		      	 xtimeout, isprefix;
277  
-	u_int			 i;
278 276
 
279 277
 	/* Check the client is good to accept input. */
280 278
 	if ((c->flags & (CLIENT_DEAD|CLIENT_SUSPENDED)) != 0)
@@ -319,6 +317,8 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
319 317
 		if (c->flags & CLIENT_READONLY)
320 318
 			return;
321 319
 		if (options_get_number(oo, "mouse-select-pane") &&
  320
+		    (!(options_get_number(oo, "status") &&
  321
+		       mouse->y + 1 == c->tty.sy)) &&
322 322
 		    ((!(mouse->b & MOUSE_DRAG) && mouse->b != MOUSE_UP) ||
323 323
 		    wp->mode != &window_copy_mode)) {
324 324
 			/*
@@ -357,14 +357,12 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
357 357
 	}
358 358
 
359 359
 	/* Is this a prefix key? */
360  
-	keylist = options_get_data(&c->session->options, "prefix");
361  
-	isprefix = 0;
362  
-	for (i = 0; i < ARRAY_LENGTH(keylist); i++) {
363  
-		if (key == ARRAY_ITEM(keylist, i)) {
364  
-			isprefix = 1;
365  
-			break;
366  
-		}
367  
-	}
  360
+	if (key == options_get_number(&c->session->options, "prefix"))
  361
+		isprefix = 1;
  362
+	else if (key == options_get_number(&c->session->options, "prefix2"))
  363
+		isprefix = 1;
  364
+	else
  365
+		isprefix = 0;
368 366
 
369 367
 	/* No previous prefix key. */
370 368
 	if (!(c->flags & CLIENT_PREFIX)) {
14  server-window.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: server-window.c 2586 2011-08-25 21:12:52Z tcunha $ */
  1
+/* $Id: server-window.c 2665 2012-01-21 19:30:07Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,8 +56,10 @@ server_window_loop(void)
56 56
 				server_status_session(s);
57 57
 			TAILQ_FOREACH(wp, &w->panes, entry)
58 58
 				server_window_check_content(s, wl, wp);
  59
+
  60
+			if (!(s->flags & SESSION_UNATTACHED))
  61
+				w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY);
59 62
 		}
60  
-		w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY);
61 63
 	}
62 64
 }
63 65
 
@@ -72,7 +74,7 @@ server_window_check_bell(struct session *s, struct winlink *wl)
72 74
 
73 75
 	if (!(w->flags & WINDOW_BELL) || wl->flags & WINLINK_BELL)
74 76
 		return (0);
75  
-	if (s->curw != wl)
  77
+	if (s->curw != wl || s->flags & SESSION_UNATTACHED)
76 78
 		wl->flags |= WINLINK_BELL;
77 79
 
78 80
 	action = options_get_number(&s->options, "bell-action");
@@ -129,7 +131,7 @@ server_window_check_activity(struct session *s, struct winlink *wl)
129 131
 
130 132
 	if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_ACTIVITY)
131 133
 		return (0);
132  
-	if (s->curw == wl)
  134
+	if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
133 135
 		return (0);
134 136
 
135 137
 	if (!options_get_number(&w->options, "monitor-activity"))
@@ -165,7 +167,7 @@ server_window_check_silence(struct session *s, struct winlink *wl)
165 167
 	if (!(w->flags & WINDOW_SILENCE) || wl->flags & WINLINK_SILENCE)
166 168
 		return (0);
167 169
 
168  
-	if (s->curw == wl) {
  170
+	if (s->curw == wl && !(s->flags & SESSION_UNATTACHED)) {
169 171
 		/*
170 172
 		 * Reset the timer for this window if we've focused it.  We
171 173
 		 * don't want the timer tripping as soon as we've switched away
@@ -217,7 +219,7 @@ server_window_check_content(
217 219
 	/* Activity flag must be set for new content. */
218 220
 	if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_CONTENT)
219 221
 		return (0);
220  
-	if (s->curw == wl)
  222
+	if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
221 223
 		return (0);
222 224
 
223 225
 	ptr = options_get_string(&w->options, "monitor-content");
50  status.c
... ...
@@ -1,4 +1,4 @@
1  
-/* $Id: status.c 2643 2011-12-06 18:47:14Z tcunha $ */
  1
+/* $Id: status.c 2663 2012-01-20 21:20:35Z tcunha $ */
2 2
 
3 3
 /*
4 4
  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -684,14 +684,34 @@ status_print(
684 684
 		fmt = options_get_string(oo, "window-status-current-format");
685 685
 	}
686 686
 
687  
-	if (wl->flags & WINLINK_ALERTFLAGS) {
688  
-		fg = options_get_number(oo, "window-status-alert-fg");
  687
+	if (wl->flags & WINLINK_BELL) {
  688
+		fg = options_get_number(oo, "window-status-bell-fg");
689 689
 		if (fg != 8)
690 690
 			colour_set_fg(gc, fg);
691  
-		bg = options_get_number(oo, "window-status-alert-bg");
  691
+		bg = options_get_number(oo, "window-status-bell-bg");
692 692
 		if (bg != 8)
693 693
 			colour_set_bg(gc, bg);
694  
-		attr = options_get_number(oo, "window-status-alert-attr");
  694
+		attr = options_get_number(oo, "window-status-bell-attr");
  695
+		if (attr != 0)
  696
+			gc->attr = attr;
  697
+	} else if (wl->flags & WINLINK_CONTENT) {
  698
+		fg = options_get_number(oo, "window-status-content-fg");
  699
+		if (fg != 8)
  700
+			colour_set_fg(gc, fg);
  701
+		bg = options_get_number(oo, "window-status-content-bg");
  702
+		if (bg != 8)
  703
+			colour_set_bg(gc, bg);
  704
+		attr = options_get_number(oo, "window-status-content-attr");
  705
+		if (attr != 0)
  706
+			gc->attr = attr;
  707
+	} else if (wl->flags & (WINLINK_ACTIVITY|WINLINK_SILENCE)) {
  708
+		fg = options_get_number(oo, "window-status-activity-fg");
  709
+		if (fg != 8)
  710
+			colour_set_fg(gc, fg);
  711
+		bg = options_get_number(oo, "window-status-activity-bg");
  712
+		if (bg != 8)
  713
+			colour_set_bg(gc, bg);
  714
+		attr = options_get_number(oo, "window-status-activity-attr");
695 715
 		if (attr != 0)
696 716
 			gc->attr = attr;
697 717
 	}
@@ -978,7 +998,7 @@ status_prompt_key(struct client *c, int key)
978 998
 	struct paste_buffer	*pb;
979 999
 	char			*s, *first, *last, word[64], swapc;
980 1000
 	const char		*histstr;
981  
-	const char		*wsep;
  1001
+	const char		*wsep = NULL;
982 1002
 	u_char			 ch;
983 1003
 	size_t			 size, n, off, idx;
984 1004
 
@@ -1124,8 +1144,12 @@ status_prompt_key(struct client *c, int key)
1124 1144
 		c->prompt_index = idx;
1125 1145
 		c->flags |= CLIENT_STATUS;
1126 1146
 		break;
  1147
+	case MODEKEYEDIT_NEXTSPACE:
  1148
+		wsep = " ";
  1149
+		/* FALLTHROUGH */
1127 1150
 	case MODEKEYEDIT_NEXTWORD:
1128  
-		wsep = options_get_string(oo, "word-separators");
  1151
+		if (wsep == NULL)
  1152
+			wsep = options_get_string(oo, "word-separators");
1129 1153