Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Import upstream snapshot from SVN r2670

  • Loading branch information...
commit 0f2e33647f9310958c3ba62ff459f08eeff441e3 1 parent 4ecaa51
@orebokech orebokech authored
View
4 cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-attach-session.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-attach-session.c 2665 2012-01-21 19:30:07Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -76,6 +76,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
ctx->curclient->session = s;
session_update_activity(s);
server_redraw_client(ctx->curclient);
+ s->curw->flags &= ~WINLINK_ALERTFLAGS;
} else {
if (!(ctx->cmdclient->flags & CLIENT_TERMINAL)) {
ctx->error(ctx, "not a terminal");
@@ -104,6 +105,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
environ_update(update, &ctx->cmdclient->environ, &s->environ);
server_redraw_client(ctx->cmdclient);
+ s->curw->flags &= ~WINLINK_ALERTFLAGS;
}
recalculate_sizes();
server_update_socket();
View
6 cmd-bind-key.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-bind-key.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-bind-key.c 2670 2012-01-21 19:38:26Z tcunha $ */
/*
* 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)
mtmp.key = key;
mtmp.mode = !!args_has(args, 'c');
- if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
+ if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
mbind->cmd = cmd;
return (0);
}
@@ -115,6 +115,6 @@ cmd_bind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key)
mbind->key = mtmp.key;
mbind->mode = mtmp.mode;
mbind->cmd = cmd;
- SPLAY_INSERT(mode_key_tree, mtab->tree, mbind);
+ RB_INSERT(mode_key_tree, mtab->tree, mbind);
return (0);
}
View
6 cmd-capture-pane.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-capture-pane.c 2595 2011-09-21 16:34:34Z tcunha $ */
+/* $Id: cmd-capture-pane.c 2651 2011-12-30 14:16:44Z tcunha $ */
/*
* Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net>
@@ -59,7 +59,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
buf = NULL;
len = 0;
- n = args_strtonum(args, 'S', SHRT_MIN, SHRT_MAX, &cause);
+ n = args_strtonum(args, 'S', INT_MIN, SHRT_MAX, &cause);
if (cause != NULL) {
top = gd->hsize;
xfree(cause);
@@ -70,7 +70,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
if (top > gd->hsize + gd->sy - 1)
top = gd->hsize + gd->sy - 1;
- n = args_strtonum(args, 'E', SHRT_MIN, SHRT_MAX, &cause);
+ n = args_strtonum(args, 'E', INT_MIN, SHRT_MAX, &cause);
if (cause != NULL) {
bottom = gd->hsize + gd->sy - 1;
xfree(cause);
View
12 cmd-list-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-keys.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-list-keys.c 2670 2012-01-21 19:38:26Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -54,9 +54,8 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
return (cmd_list_keys_table(self, ctx));
width = 0;
- *flags = '\0';
- SPLAY_FOREACH(bd, key_bindings, &key_bindings) {
+ RB_FOREACH(bd, key_bindings, &key_bindings) {
key = key_string_lookup_key(bd->key & ~KEYC_PREFIX);
if (key == NULL)
continue;
@@ -73,11 +72,12 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
width = keywidth;
}
- SPLAY_FOREACH(bd, key_bindings, &key_bindings) {
+ RB_FOREACH(bd, key_bindings, &key_bindings) {
key = key_string_lookup_key(bd->key & ~KEYC_PREFIX);
if (key == NULL)
continue;
+ *flags = '\0';
if (!(bd->key & KEYC_PREFIX)) {
if (bd->can_repeat)
xsnprintf(flags, sizeof flags, "-rn ");
@@ -116,7 +116,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx)
width = 0;
any_mode = 0;
- SPLAY_FOREACH(mbind, mode_key_tree, mtab->tree) {
+ RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
key = key_string_lookup_key(mbind->key);
if (key == NULL)
continue;
@@ -129,7 +129,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx)
width = keywidth;
}
- SPLAY_FOREACH(mbind, mode_key_tree, mtab->tree) {
+ RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
key = key_string_lookup_key(mbind->key);
if (key == NULL)
continue;
View
5 cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-window.c 2647 2011-12-09 16:37:29Z nicm $ */
+/* $Id: cmd-new-window.c 2664 2012-01-20 21:21:32Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,7 +44,8 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct args *args = self->args;
struct session *s;
struct winlink *wl;
- char *cmd, *cwd, *cause;
+ const char *cmd, *cwd;
+ char *cause;
int idx, last, detached;
if (args_has(args, 'a')) {
View
24 cmd-send-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-send-keys.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-send-keys.c 2666 2012-01-21 19:31:59Z tcunha $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <stdlib.h>
+#include <string.h>
#include "tmux.h"
@@ -30,8 +31,8 @@ int cmd_send_keys_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_send_keys_entry = {
"send-keys", "send",
- "t:", 0, -1,
- "[-t target-pane] key ...",
+ "Rt:", 0, -1,
+ "[-R] [-t target-pane] key ...",
0,
NULL,
NULL,
@@ -44,12 +45,29 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
struct args *args = self->args;
struct window_pane *wp;
struct session *s;
+ struct input_ctx *ictx;
const char *str;
int i, key;
if (cmd_find_pane(ctx, args_get(args, 't'), &s, &wp) == NULL)
return (-1);
+ if (args_has(args, 'R')) {
+ ictx = &wp->ictx;
+
+ memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell);
+ memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
+ ictx->old_cx = 0;
+ ictx->old_cy = 0;
+
+ if (wp->mode == NULL)
+ screen_write_start(&ictx->ctx, wp, &wp->base);
+ else
+ screen_write_start(&ictx->ctx, NULL, &wp->base);
+ screen_write_reset(&ictx->ctx);
+ screen_write_stop(&ictx->ctx);
+ }
+
for (i = 0; i < args->argc; i++) {
str = args->argv[i];
View
15 cmd-send-prefix.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-send-prefix.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-send-prefix.c 2669 2012-01-21 19:36:40Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,8 +28,8 @@ int cmd_send_prefix_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_send_prefix_entry = {
"send-prefix", NULL,
- "t:", 0, 0,
- CMD_TARGET_PANE_USAGE,
+ "2t:", 0, 0,
+ "[-2] " CMD_TARGET_PANE_USAGE,
0,
NULL,
NULL,
@@ -42,13 +42,16 @@ cmd_send_prefix_exec(struct cmd *self, struct cmd_ctx *ctx)
struct args *args = self->args;
struct session *s;
struct window_pane *wp;
- struct keylist *keylist;
+ int key;
if (cmd_find_pane(ctx, args_get(args, 't'), &s, &wp) == NULL)
return (-1);
- keylist = options_get_data(&s->options, "prefix");
- window_pane_key(wp, s, ARRAY_FIRST(keylist));
+ if (args_has(args, '2'))
+ key = options_get_number(&s->options, "prefix2");
+ else
+ key = options_get_number(&s->options, "prefix");
+ window_pane_key(wp, s, key);
return (0);
}
View
36 cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-option.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: cmd-set-option.c 2669 2012-01-21 19:36:40Z tcunha $ */
/*
* 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 *,
struct options_entry *cmd_set_option_number(struct cmd *, struct cmd_ctx *,
const struct options_table_entry *, struct options *,
const char *);
-struct options_entry *cmd_set_option_keys(struct cmd *, struct cmd_ctx *,
+struct options_entry *cmd_set_option_key(struct cmd *, struct cmd_ctx *,
const struct options_table_entry *, struct options *,
const char *);
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,
case OPTIONS_TABLE_NUMBER:
o = cmd_set_option_number(self, ctx, oe, oo, value);
break;
- case OPTIONS_TABLE_KEYS:
- o = cmd_set_option_keys(self, ctx, oe, oo, value);
+ case OPTIONS_TABLE_KEY:
+ o = cmd_set_option_key(self, ctx, oe, oo, value);
break;
case OPTIONS_TABLE_COLOUR:
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,
return (options_set_number(oo, oe->name, ll));
}
-/* Set a keys option. */
+/* Set a key option. */
struct options_entry *
-cmd_set_option_keys(unused struct cmd *self, struct cmd_ctx *ctx,
+cmd_set_option_key(unused struct cmd *self, struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo, const char *value)
{
- struct keylist *keylist;
- char *copy, *ptr, *s;
- int key;
-
- keylist = xmalloc(sizeof *keylist);
- ARRAY_INIT(keylist);
-
- ptr = copy = xstrdup(value);
- while ((s = strsep(&ptr, ",")) != NULL) {
- if ((key = key_string_lookup_string(s)) == KEYC_NONE) {
- ctx->error(ctx, "unknown key: %s", s);
- xfree(copy);
- xfree(keylist);
- return (NULL);
- }
- ARRAY_ADD(keylist, key);
+ int key;
+
+ if ((key = key_string_lookup_string(value)) == KEYC_NONE) {
+ ctx->error(ctx, "bad key: %s", value);
+ return (NULL);
}
- xfree(copy);
- return (options_set_data(oo, oe->name, keylist, xfree));
+ return (options_set_number(oo, oe->name, key));
}
/* Set a colour option. */
View
6 cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-split-window.c 2647 2011-12-09 16:37:29Z nicm $ */
+/* $Id: cmd-split-window.c 2664 2012-01-20 21:21:32Z tcunha $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -57,8 +57,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct window *w;
struct window_pane *wp, *new_wp = NULL;
struct environ env;
- char *cmd, *cwd, *cause, *new_cause;
- const char *shell;
+ const char *cmd, *cwd, *shell;
+ char *cause, *new_cause;
u_int hlimit, paneidx;
int size, percentage;
enum layout_type type;
View
3  cmd-switch-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-switch-client.c 2582 2011-08-21 12:38:55Z tcunha $ */
+/* $Id: cmd-switch-client.c 2665 2012-01-21 19:30:07Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -108,6 +108,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
recalculate_sizes();
server_check_unattached();
server_redraw_client(c);
+ s->curw->flags &= ~WINLINK_ALERTFLAGS;
return (0);
}
View
10 cmd-unbind-key.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-unbind-key.c 2580 2011-08-21 12:36:43Z tcunha $ */
+/* $Id: cmd-unbind-key.c 2670 2012-01-21 19:38:26Z tcunha $ */
/*
* 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)
int key;
if (args_has(args, 'a')) {
- while (!SPLAY_EMPTY(&key_bindings)) {
- bd = SPLAY_ROOT(&key_bindings);
+ while (!RB_EMPTY(&key_bindings)) {
+ bd = RB_ROOT(&key_bindings);
key_bindings_remove(bd->key);
}
return (0);
@@ -95,8 +95,8 @@ cmd_unbind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key)
mtmp.key = key;
mtmp.mode = !!args_has(args, 'c');
- if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
- SPLAY_REMOVE(mode_key_tree, mtab->tree, mbind);
+ if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
+ RB_REMOVE(mode_key_tree, mtab->tree, mbind);
xfree(mbind);
}
return (0);
View
13 cmd.c
@@ -1,4 +1,4 @@
-/* $Id: cmd.c 2647 2011-12-09 16:37:29Z nicm $ */
+/* $Id: cmd.c 2664 2012-01-20 21:21:32Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1214,17 +1214,24 @@ cmd_template_replace(char *template, const char *s, int idx)
}
/* Return the default path for a new pane. */
-char *
+const char *
cmd_get_default_path(struct cmd_ctx *ctx)
{
- char *cwd;
+ const char *cwd;
struct session *s;
struct window_pane *wp;
+ struct environ_entry *envent;
if ((s = cmd_current_session(ctx, 0)) == NULL)
return (NULL);
cwd = options_get_string(&s->options, "default-path");
+ if ((cwd[0] == '~' && cwd[1] == '\0') || !strcmp(cwd, "$HOME")) {
+ envent = environ_find(&global_environ, "HOME");
+ if (envent != NULL && *envent->value != '\0')
+ return envent->value;
+ cwd = "";
+ }
if (*cwd == '\0') {
if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL)
return (ctx->cmdclient->cwd);
View
42 colour.c
@@ -1,4 +1,4 @@
-/* $Id: colour.c 2584 2011-08-25 21:11:16Z tcunha $ */
+/* $Id: colour.c 2668 2012-01-21 19:33:45Z tcunha $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -170,6 +170,22 @@ colour_tostring(int c)
return ("white");
case 8:
return ("default");
+ case 90:
+ return ("brightblack");
+ case 91:
+ return ("brightred");
+ case 92:
+ return ("brightgreen");
+ case 93:
+ return ("brightyellow");
+ case 94:
+ return ("brightblue");
+ case 95:
+ return ("brightmagenta");
+ case 96:
+ return ("brightcyan");
+ case 97:
+ return ("brightwhite");
}
return (NULL);
}
@@ -219,6 +235,30 @@ colour_fromstring(const char *s)
return (7);
if (strcasecmp(s, "default") == 0 || (s[0] == '8' && s[1] == '\0'))
return (8);
+ if (strcasecmp(s, "brightblack") == 0 ||
+ (s[0] == '9' && s[1] == '0' && s[1] == '\0'))
+ return (90);
+ if (strcasecmp(s, "brightred") == 0 ||
+ (s[0] == '9' && s[1] == '1' && s[1] == '\0'))
+ return (91);
+ if (strcasecmp(s, "brightgreen") == 0 ||
+ (s[0] == '9' && s[1] == '2' && s[1] == '\0'))
+ return (92);
+ if (strcasecmp(s, "brightyellow") == 0 ||
+ (s[0] == '9' && s[1] == '3' && s[1] == '\0'))
+ return (93);
+ if (strcasecmp(s, "brightblue") == 0 ||
+ (s[0] == '9' && s[1] == '4' && s[1] == '\0'))
+ return (94);
+ if (strcasecmp(s, "brightmagenta") == 0 ||
+ (s[0] == '9' && s[1] == '5' && s[1] == '\0'))
+ return (95);
+ if (strcasecmp(s, "brightcyan") == 0 ||
+ (s[0] == '9' && s[1] == '6' && s[1] == '\0'))
+ return (96);
+ if (strcasecmp(s, "brightwhite") == 0 ||
+ (s[0] == '9' && s[1] == '7' && s[1] == '\0'))
+ return (97);
return (-1);
}
View
43 input.c
@@ -1,4 +1,4 @@
-/* $Id: input.c 2621 2011-10-23 15:10:22Z tcunha $ */
+/* $Id: input.c 2668 2012-01-21 19:33:45Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -119,6 +119,8 @@ const struct input_table_entry input_esc_table[] = {
/* Control (CSI) commands. */
enum input_csi_type {
INPUT_CSI_CBT,
+ INPUT_CSI_CNL,
+ INPUT_CSI_CPL,
INPUT_CSI_CUB,
INPUT_CSI_CUD,
INPUT_CSI_CUF,
@@ -135,8 +137,10 @@ enum input_csi_type {
INPUT_CSI_HPA,
INPUT_CSI_ICH,
INPUT_CSI_IL,
+ INPUT_CSI_RCP,
INPUT_CSI_RM,
INPUT_CSI_RM_PRIVATE,
+ INPUT_CSI_SCP,
INPUT_CSI_SGR,
INPUT_CSI_SM,
INPUT_CSI_SM_PRIVATE,
@@ -151,6 +155,8 @@ const struct input_table_entry input_csi_table[] = {
{ 'B', "", INPUT_CSI_CUD },
{ 'C', "", INPUT_CSI_CUF },
{ 'D', "", INPUT_CSI_CUB },
+ { 'E', "", INPUT_CSI_CNL },
+ { 'F', "", INPUT_CSI_CPL },
{ 'G', "", INPUT_CSI_HPA },
{ 'H', "", INPUT_CSI_CUP },
{ 'J', "", INPUT_CSI_ED },
@@ -171,6 +177,8 @@ const struct input_table_entry input_csi_table[] = {
{ 'n', "", INPUT_CSI_DSR },
{ 'q', " ", INPUT_CSI_DECSCUSR },
{ 'r', "", INPUT_CSI_DECSTBM },
+ { 's', "", INPUT_CSI_SCP },
+ { 'u', "", INPUT_CSI_RCP },
};
/* Input transition. */
@@ -970,17 +978,7 @@ input_esc_dispatch(struct input_ctx *ictx)
ictx->old_cx = 0;
ictx->old_cy = 0;
- screen_reset_tabs(sctx->s);
-
- screen_write_scrollregion(sctx, 0, screen_size_y(sctx->s) - 1);
-
- screen_write_insertmode(sctx, 0);
- screen_write_kcursormode(sctx, 0);
- screen_write_kkeypadmode(sctx, 0);
- screen_write_mousemode_off(sctx);
-
- screen_write_clearscreen(sctx);
- screen_write_cursormove(sctx, 0, 0);
+ screen_write_reset(sctx);
break;
case INPUT_ESC_IND:
screen_write_linefeed(sctx, 0);
@@ -1081,6 +1079,14 @@ input_csi_dispatch(struct input_ctx *ictx)
case INPUT_CSI_CUU:
screen_write_cursorup(sctx, input_get(ictx, 0, 1, 1));
break;
+ case INPUT_CSI_CNL:
+ screen_write_carriagereturn(sctx);
+ screen_write_cursordown(sctx, input_get(ictx, 0, 1, 1));
+ break;
+ case INPUT_CSI_CPL:
+ screen_write_carriagereturn(sctx);
+ screen_write_cursorup(sctx, input_get(ictx, 0, 1, 1));
+ break;
case INPUT_CSI_DA:
switch (input_get(ictx, 0, 0, 0)) {
case 0:
@@ -1168,6 +1174,10 @@ input_csi_dispatch(struct input_ctx *ictx)
case INPUT_CSI_IL:
screen_write_insertline(sctx, input_get(ictx, 0, 1, 1));
break;
+ case INPUT_CSI_RCP:
+ memcpy(&ictx->cell, &ictx->old_cell, sizeof ictx->cell);
+ screen_write_cursormove(sctx, ictx->old_cx, ictx->old_cy);
+ break;
case INPUT_CSI_RM:
switch (input_get(ictx, 0, 0, -1)) {
case 4: /* IRM */
@@ -1207,6 +1217,11 @@ input_csi_dispatch(struct input_ctx *ictx)
break;
}
break;
+ case INPUT_CSI_SCP:
+ memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
+ ictx->old_cx = s->cx;
+ ictx->old_cy = s->cy;
+ break;
case INPUT_CSI_SGR:
input_csi_dispatch_sgr(ictx);
break;
@@ -1421,7 +1436,7 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
case 106:
case 107:
gc->flags &= ~GRID_FLAG_BG256;
- gc->bg = n;
+ gc->bg = n - 10;
break;
}
}
@@ -1533,6 +1548,8 @@ input_exit_rename(struct input_ctx *ictx)
{
if (ictx->flags & INPUT_DISCARD)
return;
+ if (!options_get_number(&ictx->wp->window->options, "allow-rename"))
+ return;
log_debug("%s: \"%s\"", __func__, ictx->input_buf);
xfree(ictx->wp->window->name);
View
20 key-bindings.c
@@ -1,4 +1,4 @@
-/* $Id: key-bindings.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: key-bindings.c 2670 2012-01-21 19:38:26Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -24,7 +24,7 @@
#include "tmux.h"
-SPLAY_GENERATE(key_bindings, key_binding, entry, key_bindings_cmp);
+RB_GENERATE(key_bindings, key_binding, entry, key_bindings_cmp);
struct key_bindings key_bindings;
struct key_bindings dead_key_bindings;
@@ -52,7 +52,7 @@ key_bindings_lookup(int key)
struct key_binding bd;
bd.key = key;
- return (SPLAY_FIND(key_bindings, &key_bindings, &bd));
+ return (RB_FIND(key_bindings, &key_bindings, &bd));
}
void
@@ -64,7 +64,7 @@ key_bindings_add(int key, int can_repeat, struct cmd_list *cmdlist)
bd = xmalloc(sizeof *bd);
bd->key = key;
- SPLAY_INSERT(key_bindings, &key_bindings, bd);
+ RB_INSERT(key_bindings, &key_bindings, bd);
bd->can_repeat = can_repeat;
bd->cmdlist = cmdlist;
@@ -77,8 +77,8 @@ key_bindings_remove(int key)
if ((bd = key_bindings_lookup(key)) == NULL)
return;
- SPLAY_REMOVE(key_bindings, &key_bindings, bd);
- SPLAY_INSERT(key_bindings, &dead_key_bindings, bd);
+ RB_REMOVE(key_bindings, &key_bindings, bd);
+ RB_INSERT(key_bindings, &dead_key_bindings, bd);
}
void
@@ -86,9 +86,9 @@ key_bindings_clean(void)
{
struct key_binding *bd;
- while (!SPLAY_EMPTY(&dead_key_bindings)) {
- bd = SPLAY_ROOT(&dead_key_bindings);
- SPLAY_REMOVE(key_bindings, &dead_key_bindings, bd);
+ while (!RB_EMPTY(&dead_key_bindings)) {
+ bd = RB_ROOT(&dead_key_bindings);
+ RB_REMOVE(key_bindings, &dead_key_bindings, bd);
cmd_list_free(bd->cmdlist);
xfree(bd);
}
@@ -179,7 +179,7 @@ key_bindings_init(void)
struct cmd *cmd;
struct cmd_list *cmdlist;
- SPLAY_INIT(&key_bindings);
+ RB_INIT(&key_bindings);
for (i = 0; i < nitems(table); i++) {
cmdlist = xmalloc(sizeof *cmdlist);
View
6 key-string.c
@@ -1,4 +1,4 @@
-/* $Id: key-string.c 2622 2011-10-23 15:11:09Z tcunha $ */
+/* $Id: key-string.c 2669 2012-01-21 19:36:40Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -188,6 +188,10 @@ key_string_lookup_key(int key)
*out = '\0';
+ /* Handle no key. */
+ if (key == KEYC_NONE)
+ return ("none");
+
/*
* Special case: display C-@ as C-Space. Could do this below in
* the (key >= 0 && key <= 32), but this way we let it be found
View
16 mode-key.c
@@ -1,4 +1,4 @@
-/* $Id: mode-key.c 2646 2011-12-06 18:50:26Z tcunha $ */
+/* $Id: mode-key.c 2670 2012-01-21 19:38:26Z tcunha $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -54,9 +54,12 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
{ MODEKEYEDIT_ENTER, "enter" },
{ MODEKEYEDIT_HISTORYDOWN, "history-down" },
{ MODEKEYEDIT_HISTORYUP, "history-up" },
+ { MODEKEYEDIT_NEXTSPACE, "next-space" },
+ { MODEKEYEDIT_NEXTSPACEEND, "next-space-end" },
{ MODEKEYEDIT_NEXTWORD, "next-word" },
{ MODEKEYEDIT_NEXTWORDEND, "next-word-end" },
{ MODEKEYEDIT_PASTE, "paste" },
+ { MODEKEYEDIT_PREVIOUSSPACE, "previous-space" },
{ MODEKEYEDIT_PREVIOUSWORD, "previous-word" },
{ MODEKEYEDIT_STARTOFLINE, "start-of-line" },
{ MODEKEYEDIT_SWITCHMODE, "switch-mode" },
@@ -148,7 +151,10 @@ const struct mode_key_entry mode_key_vi_edit[] = {
{ '$', 1, MODEKEYEDIT_ENDOFLINE },
{ '0', 1, MODEKEYEDIT_STARTOFLINE },
+ { 'B', 1, MODEKEYEDIT_PREVIOUSSPACE },
{ 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE },
+ { 'E', 1, MODEKEYEDIT_NEXTSPACEEND },
+ { 'W', 1, MODEKEYEDIT_NEXTSPACE },
{ 'X', 1, MODEKEYEDIT_BACKSPACE },
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL },
{ '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE },
@@ -406,7 +412,7 @@ const struct mode_key_table mode_key_tables[] = {
{ NULL, NULL, NULL, NULL }
};
-SPLAY_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
+RB_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
int
mode_key_cmp(struct mode_key_binding *mbind1, struct mode_key_binding *mbind2)
@@ -456,13 +462,13 @@ mode_key_init_trees(void)
struct mode_key_binding *mbind;
for (mtab = mode_key_tables; mtab->name != NULL; mtab++) {
- SPLAY_INIT(mtab->tree);
+ RB_INIT(mtab->tree);
for (ment = mtab->table; ment->mode != -1; ment++) {
mbind = xmalloc(sizeof *mbind);
mbind->key = ment->key;
mbind->mode = ment->mode;
mbind->cmd = ment->cmd;
- SPLAY_INSERT(mode_key_tree, mtab->tree, mbind);
+ RB_INSERT(mode_key_tree, mtab->tree, mbind);
}
}
}
@@ -481,7 +487,7 @@ mode_key_lookup(struct mode_key_data *mdata, int key)
mtmp.key = key;
mtmp.mode = mdata->mode;
- if ((mbind = SPLAY_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) {
+ if ((mbind = RB_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) {
if (mdata->mode != 0)
return (MODEKEY_NONE);
return (MODEKEY_OTHER);
View
68 options-table.c
@@ -1,4 +1,4 @@
-/* $Id: options-table.c 2640 2011-11-25 13:33:04Z tcunha $ */
+/* $Id: options-table.c 2669 2012-01-21 19:36:40Z tcunha $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -261,8 +261,13 @@ const struct options_table_entry session_options_table[] = {
},
{ .name = "prefix",
- .type = OPTIONS_TABLE_KEYS,
- /* set in main() */
+ .type = OPTIONS_TABLE_KEY,
+ .default_num = '\002',
+ },
+
+ { .name = "prefix2",
+ .type = OPTIONS_TABLE_KEY,
+ .default_num = KEYC_NONE,
},
{ .name = "repeat-time",
@@ -435,6 +440,11 @@ const struct options_table_entry window_options_table[] = {
.default_num = 0
},
+ { .name = "allow-rename",
+ .type = OPTIONS_TABLE_FLAG,
+ .default_num = 1
+ },
+
{ .name = "alternate-screen",
.type = OPTIONS_TABLE_FLAG,
.default_num = 1
@@ -564,17 +574,47 @@ const struct options_table_entry window_options_table[] = {
.default_num = 0 /* overridden in main() */
},
- { .name = "window-status-alert-attr",
+ { .name = "window-status-bell-attr",
+ .type = OPTIONS_TABLE_ATTRIBUTES,
+ .default_num = GRID_ATTR_REVERSE
+ },
+
+ { .name = "window-status-bell-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8
+ },
+
+ { .name = "window-status-bell-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8
+ },
+
+ { .name = "window-status-content-attr",
+ .type = OPTIONS_TABLE_ATTRIBUTES,
+ .default_num = GRID_ATTR_REVERSE
+ },
+
+ { .name = "window-status-content-bg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8
+ },
+
+ { .name = "window-status-content-fg",
+ .type = OPTIONS_TABLE_COLOUR,
+ .default_num = 8
+ },
+
+ { .name = "window-status-activity-attr",
.type = OPTIONS_TABLE_ATTRIBUTES,
.default_num = GRID_ATTR_REVERSE
},
- { .name = "window-status-alert-bg",
+ { .name = "window-status-activity-bg",
.type = OPTIONS_TABLE_COLOUR,
.default_num = 8
},
- { .name = "window-status-alert-fg",
+ { .name = "window-status-activity-fg",
.type = OPTIONS_TABLE_COLOUR,
.default_num = 8
},
@@ -647,10 +687,8 @@ const char *
options_table_print_entry(
const struct options_table_entry *oe, struct options_entry *o)
{
- static char out[BUFSIZ];
- const char *s;
- struct keylist *keylist;
- u_int i;
+ static char out[BUFSIZ];
+ const char *s;
*out = '\0';
switch (oe->type) {
@@ -660,14 +698,8 @@ options_table_print_entry(
case OPTIONS_TABLE_NUMBER:
xsnprintf(out, sizeof out, "%lld", o->num);
break;
- case OPTIONS_TABLE_KEYS:
- keylist = o->data;
- for (i = 0; i < ARRAY_LENGTH(keylist); i++) {
- s = key_string_lookup_key(ARRAY_ITEM(keylist, i));
- strlcat(out, s, sizeof out);
- if (i != ARRAY_LENGTH(keylist) - 1)
- strlcat(out, ",", sizeof out);
- }
+ case OPTIONS_TABLE_KEY:
+ xsnprintf(out, sizeof out, "%s", key_string_lookup_key(o->num));
break;
case OPTIONS_TABLE_COLOUR:
s = colour_tostring(o->num);
View
65 options.c
@@ -1,4 +1,4 @@
-/* $Id: options.c 2553 2011-07-09 09:42:33Z tcunha $ */
+/* $Id: options.c 2670 2012-01-21 19:38:26Z tcunha $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,7 +28,7 @@
* a splay tree.
*/
-SPLAY_GENERATE(options_tree, options_entry, entry, options_cmp);
+RB_GENERATE(options_tree, options_entry, entry, options_cmp);
int
options_cmp(struct options_entry *o1, struct options_entry *o2)
@@ -39,7 +39,7 @@ options_cmp(struct options_entry *o1, struct options_entry *o2)
void
options_init(struct options *oo, struct options *parent)
{
- SPLAY_INIT(&oo->tree);
+ RB_INIT(&oo->tree);
oo->parent = parent;
}
@@ -48,14 +48,12 @@ options_free(struct options *oo)
{
struct options_entry *o;
- while (!SPLAY_EMPTY(&oo->tree)) {
- o = SPLAY_ROOT(&oo->tree);
- SPLAY_REMOVE(options_tree, &oo->tree, o);
+ while (!RB_EMPTY(&oo->tree)) {
+ o = RB_ROOT(&oo->tree);
+ RB_REMOVE(options_tree, &oo->tree, o);
xfree(o->name);
if (o->type == OPTIONS_STRING)
xfree(o->str);
- else if (o->type == OPTIONS_DATA)
- o->freefn(o->data);
xfree(o);
}
}
@@ -66,7 +64,7 @@ options_find1(struct options *oo, const char *name)
struct options_entry p;
p.name = (char *) name;
- return (SPLAY_FIND(options_tree, &oo->tree, &p));
+ return (RB_FIND(options_tree, &oo->tree, &p));
}
struct options_entry *
@@ -75,12 +73,12 @@ options_find(struct options *oo, const char *name)
struct options_entry *o, p;
p.name = (char *) name;
- o = SPLAY_FIND(options_tree, &oo->tree, &p);
+ o = RB_FIND(options_tree, &oo->tree, &p);
while (o == NULL) {
oo = oo->parent;
if (oo == NULL)
break;
- o = SPLAY_FIND(options_tree, &oo->tree, &p);
+ o = RB_FIND(options_tree, &oo->tree, &p);
}
return (o);
}
@@ -93,12 +91,10 @@ options_remove(struct options *oo, const char *name)
if ((o = options_find1(oo, name)) == NULL)
return;
- SPLAY_REMOVE(options_tree, &oo->tree, o);
+ RB_REMOVE(options_tree, &oo->tree, o);
xfree(o->name);
if (o->type == OPTIONS_STRING)
xfree(o->str);
- else if (o->type == OPTIONS_DATA)
- o->freefn(o->data);
xfree(o);
}
@@ -111,11 +107,9 @@ options_set_string(struct options *oo, const char *name, const char *fmt, ...)
if ((o = options_find1(oo, name)) == NULL) {
o = xmalloc(sizeof *o);
o->name = xstrdup(name);
- SPLAY_INSERT(options_tree, &oo->tree, o);
+ RB_INSERT(options_tree, &oo->tree, o);
} else if (o->type == OPTIONS_STRING)
xfree(o->str);
- else if (o->type == OPTIONS_DATA)
- o->freefn(o->data);
va_start(ap, fmt);
o->type = OPTIONS_STRING;
@@ -144,11 +138,9 @@ options_set_number(struct options *oo, const char *name, long long value)
if ((o = options_find1(oo, name)) == NULL) {
o = xmalloc(sizeof *o);
o->name = xstrdup(name);
- SPLAY_INSERT(options_tree, &oo->tree, o);
+ RB_INSERT(options_tree, &oo->tree, o);
} else if (o->type == OPTIONS_STRING)
xfree(o->str);
- else if (o->type == OPTIONS_DATA)
- o->freefn(o->data);
o->type = OPTIONS_NUMBER;
o->num = value;
@@ -166,36 +158,3 @@ options_get_number(struct options *oo, const char *name)
fatalx("option not a number");
return (o->num);
}
-
-struct options_entry *
-options_set_data(
- struct options *oo, const char *name, void *value, void (*freefn)(void *))
-{
- struct options_entry *o;
-
- if ((o = options_find1(oo, name)) == NULL) {
- o = xmalloc(sizeof *o);
- o->name = xstrdup(name);
- SPLAY_INSERT(options_tree, &oo->tree, o);
- } else if (o->type == OPTIONS_STRING)
- xfree(o->str);
- else if (o->type == OPTIONS_DATA)
- o->freefn(o->data);
-
- o->type = OPTIONS_DATA;
- o->data = value;
- o->freefn = freefn;
- return (o);
-}
-
-void *
-options_get_data(struct options *oo, const char *name)
-{
- struct options_entry *o;
-
- if ((o = options_find(oo, name)) == NULL)
- fatalx("missing option");
- if (o->type != OPTIONS_DATA)
- fatalx("option not data");
- return (o->data);
-}
View
20 screen-write.c
@@ -1,4 +1,4 @@
-/* $Id: screen-write.c 2621 2011-10-23 15:10:22Z tcunha $ */
+/* $Id: screen-write.c 2666 2012-01-21 19:31:59Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -46,6 +46,24 @@ screen_write_stop(unused struct screen_write_ctx *ctx)
{
}
+
+/* Reset screen state. */
+void
+screen_write_reset(struct screen_write_ctx *ctx)
+{
+ screen_reset_tabs(ctx->s);
+
+ screen_write_scrollregion(ctx, 0, screen_size_y(ctx->s) - 1);
+
+ screen_write_insertmode(ctx, 0);
+ screen_write_kcursormode(ctx, 0);
+ screen_write_kkeypadmode(ctx, 0);
+ screen_write_mousemode_off(ctx);
+
+ screen_write_clearscreen(ctx);
+ screen_write_cursormove(ctx, 0, 0);
+}
+
/* Write character. */
void
screen_write_putc(
View
20 server-client.c
@@ -1,4 +1,4 @@
-/* $Id: server-client.c 2583 2011-08-21 12:39:34Z tcunha $ */
+/* $Id: server-client.c 2669 2012-01-21 19:36:40Z tcunha $ */
/*
* 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)
struct options *oo;
struct timeval tv;
struct key_binding *bd;
- struct keylist *keylist;
int xtimeout, isprefix;
- u_int i;
/* Check the client is good to accept input. */
if ((c->flags & (CLIENT_DEAD|CLIENT_SUSPENDED)) != 0)
@@ -319,6 +317,8 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
if (c->flags & CLIENT_READONLY)
return;
if (options_get_number(oo, "mouse-select-pane") &&
+ (!(options_get_number(oo, "status") &&
+ mouse->y + 1 == c->tty.sy)) &&
((!(mouse->b & MOUSE_DRAG) && mouse->b != MOUSE_UP) ||
wp->mode != &window_copy_mode)) {
/*
@@ -357,14 +357,12 @@ server_client_handle_key(int key, struct mouse_event *mouse, void *data)
}
/* Is this a prefix key? */
- keylist = options_get_data(&c->session->options, "prefix");
- isprefix = 0;
- for (i = 0; i < ARRAY_LENGTH(keylist); i++) {
- if (key == ARRAY_ITEM(keylist, i)) {
- isprefix = 1;
- break;
- }
- }
+ if (key == options_get_number(&c->session->options, "prefix"))
+ isprefix = 1;
+ else if (key == options_get_number(&c->session->options, "prefix2"))
+ isprefix = 1;
+ else
+ isprefix = 0;
/* No previous prefix key. */
if (!(c->flags & CLIENT_PREFIX)) {
View
14 server-window.c
@@ -1,4 +1,4 @@
-/* $Id: server-window.c 2586 2011-08-25 21:12:52Z tcunha $ */
+/* $Id: server-window.c 2665 2012-01-21 19:30:07Z tcunha $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,8 +56,10 @@ server_window_loop(void)
server_status_session(s);
TAILQ_FOREACH(wp, &w->panes, entry)
server_window_check_content(s, wl, wp);
+
+ if (!(s->flags & SESSION_UNATTACHED))
+ w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY);
}
- w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY);
}
}
@@ -72,7 +74,7 @@ server_window_check_bell(struct session *s, struct winlink *wl)
if (!(w->flags & WINDOW_BELL) || wl->flags & WINLINK_BELL)
return (0);
- if (s->curw != wl)
+ if (s->curw != wl || s->flags & SESSION_UNATTACHED)
wl->flags |= WINLINK_BELL;
action = options_get_number(&s->options, "bell-action");
@@ -129,7 +131,7 @@ server_window_check_activity(struct session *s, struct winlink *wl)
if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_ACTIVITY)
return (0);
- if (s->curw == wl)
+ if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
return (0);
if (!options_get_number(&w->options, "monitor-activity"))
@@ -165,7 +167,7 @@ server_window_check_silence(struct session *s, struct winlink *wl)
if (!(w->flags & WINDOW_SILENCE) || wl->flags & WINLINK_SILENCE)
return (0);
- if (s->curw == wl) {
+ if (s->curw == wl && !(s->flags & SESSION_UNATTACHED)) {
/*
* Reset the timer for this window if we've focused it. We
* don't want the timer tripping as soon as we've switched away
@@ -217,7 +219,7 @@ server_window_check_content(
/* Activity flag must be set for new content. */
if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_CONTENT)
return (0);
- if (s->curw == wl)
+ if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
return (0);
ptr = options_get_string(&w->options, "monitor-content");
View
50 status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c 2643 2011-12-06 18:47:14Z tcunha $ */
+/* $Id: status.c 2663 2012-01-20 21:20:35Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -684,14 +684,34 @@ status_print(
fmt = options_get_string(oo, "window-status-current-format");
}
- if (wl->flags & WINLINK_ALERTFLAGS) {
- fg = options_get_number(oo, "window-status-alert-fg");
+ if (wl->flags & WINLINK_BELL) {
+ fg = options_get_number(oo, "window-status-bell-fg");
if (fg != 8)
colour_set_fg(gc, fg);
- bg = options_get_number(oo, "window-status-alert-bg");
+ bg = options_get_number(oo, "window-status-bell-bg");
if (bg != 8)
colour_set_bg(gc, bg);
- attr = options_get_number(oo, "window-status-alert-attr");
+ attr = options_get_number(oo, "window-status-bell-attr");
+ if (attr != 0)
+ gc->attr = attr;
+ } else if (wl->flags & WINLINK_CONTENT) {
+ fg = options_get_number(oo, "window-status-content-fg");
+ if (fg != 8)
+ colour_set_fg(gc, fg);
+ bg = options_get_number(oo, "window-status-content-bg");
+ if (bg != 8)
+ colour_set_bg(gc, bg);
+ attr = options_get_number(oo, "window-status-content-attr");
+ if (attr != 0)
+ gc->attr = attr;
+ } else if (wl->flags & (WINLINK_ACTIVITY|WINLINK_SILENCE)) {
+ fg = options_get_number(oo, "window-status-activity-fg");
+ if (fg != 8)
+ colour_set_fg(gc, fg);
+ bg = options_get_number(oo, "window-status-activity-bg");
+ if (bg != 8)
+ colour_set_bg(gc, bg);
+ attr = options_get_number(oo, "window-status-activity-attr");
if (attr != 0)
gc->attr = attr;
}
@@ -978,7 +998,7 @@ status_prompt_key(struct client *c, int key)
struct paste_buffer *pb;
char *s, *first, *last, word[64], swapc;
const char *histstr;
- const char *wsep;
+ const char *wsep = NULL;
u_char ch;
size_t size, n, off, idx;
@@ -1124,8 +1144,12 @@ status_prompt_key(struct client *c, int key)
c->prompt_index = idx;
c->flags |= CLIENT_STATUS;
break;
+ case MODEKEYEDIT_NEXTSPACE:
+ wsep = " ";
+ /* FALLTHROUGH */
case MODEKEYEDIT_NEXTWORD:
- wsep = options_get_string(oo, "word-separators");
+ if (wsep == NULL)
+ wsep = options_get_string(oo, "word-separators");
/* Find a separator. */
while (c->prompt_index != size) {
@@ -1143,8 +1167,12 @@ status_prompt_key(struct client *c, int key)
c->flags |= CLIENT_STATUS;
break;
+ case MODEKEYEDIT_NEXTSPACEEND:
+ wsep = " ";
+ /* FALLTHROUGH */
case MODEKEYEDIT_NEXTWORDEND:
- wsep = options_get_string(oo, "word-separators");
+ if (wsep == NULL)
+ wsep = options_get_string(oo, "word-separators");
/* Find a word. */
while (c->prompt_index != size) {
@@ -1162,8 +1190,12 @@ status_prompt_key(struct client *c, int key)
c->flags |= CLIENT_STATUS;
break;
+ case MODEKEYEDIT_PREVIOUSSPACE:
+ wsep = " ";
+ /* FALLTHROUGH */
case MODEKEYEDIT_PREVIOUSWORD:
- wsep = options_get_string(oo, "word-separators");
+ if (wsep == NULL)
+ wsep = options_get_string(oo, "word-separators");
/* Find a non-separator. */
while (c->prompt_index != 0) {
View
161 tmux.1
@@ -593,7 +593,7 @@ session.
.D1 (alias: Ic detach )
Detach the current client if bound to a key, the client specified with
.Fl t ,
-or all clients currently attached to to the session specified by
+or all clients currently attached to the session specified by
.Fl s .
If
.Fl P
@@ -1638,6 +1638,7 @@ are listed; this may be one of:
or
.Em emacs-copy .
.It Xo Ic send-keys
+.Fl R
.Op Fl t Ar target-pane
.Ar key Ar ...
.Xc
@@ -1652,9 +1653,16 @@ or
) to send; if the string is not recognised as a key, it is sent as a series of
characters.
All arguments are sent sequentially from first to last.
-.It Ic send-prefix Op Fl t Ar target-pane
-Send the prefix key to a window as if it was pressed.
-If multiple prefix keys are configured, only the first is sent.
+The
+.Fl R
+flag causes the terminal state to be reset.
+.It Xo Ic send-prefix
+.Op Fl 2
+.Op Fl t Ar target-pane
+.Xc
+Send the prefix key, or with
+.Fl 2
+the secondary prefix key, to a window as if it was pressed.
.It Xo Ic unbind-key
.Op Fl acn
.Op Fl t Ar key-table
@@ -1849,6 +1857,16 @@ Set the default working directory for new panes.
If empty (the default), the working directory is determined from the process
running in the active pane, from the command line environment or from the
working directory where the session was created.
+If
+.Ar path
+is "$HOME" or "~", the value of the
+.Ev HOME
+environment variable is used.
+If
+.Ar path
+is ".", the working directory when
+.Nm
+was started is used.
.It Ic default-shell Ar path
Specify the default shell.
This is used as the login shell for new windows when the
@@ -1966,6 +1984,10 @@ is one of:
.Ic magenta ,
.Ic cyan ,
.Ic white ,
+aixterm bright variants (if supported:
+.Ic brightred ,
+.Ic brightgreen ,
+and so on),
.Ic colour0
to
.Ic colour255
@@ -2015,11 +2037,10 @@ Set the pane border colour for the currently active pane.
.It Ic pane-border-bg Ar colour
.It Ic pane-border-fg Ar colour
Set the pane border colour for panes aside from the active pane.
-.It Ic prefix Ar keys
-Set the keys accepted as a prefix key.
-.Ar keys
-is a comma-separated list of key names, each of which individually behave as
-the prefix key.
+.It Ic prefix Ar key
+Set the key accepted as a prefix key.
+.It Ic prefix2 Ar key
+Set a secondary key accepted as a prefix key.
.It Ic repeat-time Ar time
Allow multiple commands to be entered without pressing the prefix-key again
in the specified
@@ -2048,7 +2069,14 @@ command to destroy it.
.It Xo Ic set-titles
.Op Ic on | off
.Xc
-Attempt to set the window title using the \ee]2;...\e007 xterm code if
+Attempt to set the client terminal title using the
+.Em tsl
+and
+.Em fsl
+.Xr terminfo 5
+entries if they exist.
+.Nm
+automatically sets these to the \ee]2;...\e007 sequence if
the terminal appears to be an xterm.
This option is off by default.
Note that elinks
@@ -2114,7 +2142,7 @@ may contain any of the following special character sequences:
.It Li "#I" Ta "Current window index"
.It Li "#P" Ta "Current pane index"
.It Li "#S" Ta "Session name"
-.It Li "#T" Ta "Current window title"
+.It Li "#T" Ta "Current pane title"
.It Li "#W" Ta "Current window name"
.It Li "##" Ta "A literal" Ql #
.El
@@ -2133,13 +2161,9 @@ global environment set (see the
.Sx ENVIRONMENT
section).
.Pp
-The window title (#T) is the title set by the program running within the window
-using the OSC title setting sequence, for example:
-.Bd -literal -offset indent
-$ printf '\e033]2;My Title\e033\e\e'
-.Ed
-.Pp
-When a window is first created, its title is the hostname.
+For details on how the names and titles can be set see the
+.Sx "NAMES AND TITLES"
+section.
.Pp
#[attributes] allows a comma-separated list of attributes to be specified,
these may be
@@ -2333,6 +2357,13 @@ this option is good for full-screen programs which support
.Dv SIGWINCH
and poor for interactive programs such as shells.
.Pp
+.It Xo Ic allow-rename
+.Op Ic on | off
+.Xc
+Allow programs to change the window name using a terminal escape
+sequence (\\033k...\\033\\\\).
+The default is on.
+.Pp
.It Xo Ic alternate-screen
.Op Ic on | off
.Xc
@@ -2363,7 +2394,8 @@ is specified at creation with
or
.Ic new-session ,
or later with
-.Ic rename-window .
+.Ic rename-window ,
+or with a terminal escape sequence.
It may be switched off globally with:
.Bd -literal -offset indent
set-window-option -g automatic-rename off
@@ -2499,15 +2531,32 @@ Instructs
.Nm
to expect UTF-8 sequences to appear in this window.
.Pp
-.It Ic window-status-alert-attr Ar attributes
-Set status line attributes for windows which have an alert (bell, activity
-or content).
+.It Ic window-status-bell-attr Ar attributes
+Set status line attributes for windows which have a bell alert.
+.Pp
+.It Ic window-status-bell-bg Ar colour
+Set status line background colour for windows with a bell alert.
+.Pp
+.It Ic window-status-bell-fg Ar colour
+Set status line foreground colour for windows with a bell alert.
+.Pp
+.It Ic window-status-content-attr Ar attributes
+Set status line attributes for windows which have a content alert.
+.Pp
+.It Ic window-status-content-bg Ar colour
+Set status line background colour for windows with a content alert.
+.Pp
+.It Ic window-status-content-fg Ar colour
+Set status line foreground colour for windows with a content alert.
.Pp
-.It Ic window-status-alert-bg Ar colour
-Set status line background colour for windows with an alert.
+.It Ic window-status-activity-attr Ar attributes
+Set status line attributes for windows which have an activity (or silence) alert.
.Pp
-.It Ic window-status-alert-fg Ar colour
-Set status line foreground colour for windows with an alert.
+.It Ic window-status-activity-bg Ar colour
+Set status line background colour for windows with an activity alert.
+.Pp
+.It Ic window-status-activity-fg Ar colour
+Set status line foreground colour for windows with an activity alert.
.Pp
.It Ic window-status-attr Ar attributes
Set status line attributes for a single window.
@@ -2658,6 +2707,62 @@ The following variables are available, where appropriate:
.It Li "window_name" Ta "Name of window"
.It Li "window_width" Ta "Width of window"
.El
+.Sh NAMES AND TITLES
+.Nm
+distinguishes between names and titles.
+Windows and sessions have names, which may be used to specify them in targets
+and are displayed in the status line and various lists: the name is the
+.Nm
+identifier for a window or session.
+Only panes have titles.
+A pane's title is typically set by the program running inside the pane and
+is not modified by
+.Nm .
+It is the same mechanism used to set for example the
+.Xr xterm 1
+window title in an
+.Xr X 7
+window manager.
+Windows themselves do not have titles - a window's title is the title of it's
+active pane.
+.Nm
+itself may set the title of the terminal in which the client is running, see
+the
+.Ic set-titles
+option.
+.Pp
+A session's name is set with the
+.Ic new-session
+and
+.Ic rename-session
+commands.
+A window's name is set with one of:
+.Bl -enum -width Ds
+.It
+A command argument (such as
+.Fl n
+for
+.Ic new-window
+or
+.Ic new-session ) .
+.It
+An escape sequence:
+.Bd -literal -offset indent
+$ printf '\e033kWINDOW_NAME\e033\e\e'
+.Ed
+.It
+Automatic renaming, which sets the name to the active command in the window's
+active pane.
+See the
+.Ic automatic-rename
+option.
+.El
+.Pp
+When a pane is first created, its title is the hostname.
+A pane's title can be set via the OSC title setting sequence, for example:
+.Bd -literal -offset indent
+$ printf '\e033]2;My Title\e033\e\e'
+.Ed
.Sh ENVIRONMENT
When the server is started,
.Nm
@@ -2721,8 +2826,8 @@ terminal.
By default, the status line is enabled (it may be disabled with the
.Ic status
session option) and contains, from left-to-right: the name of the current
-session in square brackets; the window list; the current window title in double
-quotes; and the time and date.
+session in square brackets; the window list; the title of the active pane
+in double quotes; and the time and date.
.Pp
The status line is made of three parts: configurable left and right sections
(which may contain dynamic content such as the time or output from a shell
View
9 tmux.c
@@ -1,4 +1,4 @@
-/* $Id: tmux.c 2620 2011-10-23 15:08:58Z tcunha $ */
+/* $Id: tmux.c 2669 2012-01-21 19:36:40Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -235,7 +235,6 @@ int
main(int argc, char **argv)
{
struct passwd *pw;
- struct keylist *keylist;
char *s, *path, *label, *home, **var;
int opt, flags, quiet, keys;
@@ -335,12 +334,6 @@ main(int argc, char **argv)
options_init(&global_w_options, NULL);
options_table_populate_tree(window_options_table, &global_w_options);
- /* Set the prefix option (its a list, so not in the table). */
- keylist = xmalloc(sizeof *keylist);
- ARRAY_INIT(keylist);
- ARRAY_ADD(keylist, '\002');
- options_set_data(&global_s_options, "prefix", keylist, xfree);
-
/* Enable UTF-8 if the first client is on UTF-8 terminal. */
if (flags & IDENTIFY_UTF8) {
options_set_number(&global_s_options, "status-utf8", 1);
View
37 tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h 2647 2011-12-09 16:37:29Z nicm $ */
+/* $Id: tmux.h 2670 2012-01-21 19:38:26Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -443,9 +443,12 @@ enum mode_key_cmd {
MODEKEYEDIT_ENTER,
MODEKEYEDIT_HISTORYDOWN,
MODEKEYEDIT_HISTORYUP,
+ MODEKEYEDIT_NEXTSPACE,
+ MODEKEYEDIT_NEXTSPACEEND,
MODEKEYEDIT_NEXTWORD,
MODEKEYEDIT_NEXTWORDEND,
MODEKEYEDIT_PASTE,
+ MODEKEYEDIT_PREVIOUSSPACE,
MODEKEYEDIT_PREVIOUSWORD,
MODEKEYEDIT_STARTOFLINE,
MODEKEYEDIT_SWITCHMODE,
@@ -538,9 +541,9 @@ struct mode_key_binding {
int mode;
enum mode_key_cmd cmd;
- SPLAY_ENTRY(mode_key_binding) entry;
+ RB_ENTRY(mode_key_binding) entry;
};
-SPLAY_HEAD(mode_key_tree, mode_key_binding);
+RB_HEAD(mode_key_tree, mode_key_binding);
/* Command to string mapping. */
struct mode_key_cmdstr {
@@ -666,21 +669,15 @@ struct options_entry {
char *str;
long long num;
- void *data;
-
- void (*freefn)(void *);
- SPLAY_ENTRY(options_entry) entry;
+ RB_ENTRY(options_entry) entry;
};
struct options {
- SPLAY_HEAD(options_tree, options_entry) tree;
+ RB_HEAD(options_tree, options_entry) tree;
struct options *parent;
};
-/* Key list for prefix option. */
-ARRAY_DECL(keylist, int);
-
/* Scheduled job. */
struct job {
char *cmd;
@@ -1275,9 +1272,9 @@ struct key_binding {
struct cmd_list *cmdlist;
int can_repeat;
- SPLAY_ENTRY(key_binding) entry;
+ RB_ENTRY(key_binding) entry;
};
-SPLAY_HEAD(key_bindings, key_binding);
+RB_HEAD(key_bindings, key_binding);
/*
* Option table entries. The option table is the user-visible part of the
@@ -1287,7 +1284,7 @@ SPLAY_HEAD(key_bindings, key_binding);
enum options_table_type {
OPTIONS_TABLE_STRING,
OPTIONS_TABLE_NUMBER,
- OPTIONS_TABLE_KEYS,
+ OPTIONS_TABLE_KEY,
OPTIONS_TABLE_COLOUR,
OPTIONS_TABLE_ATTRIBUTES,
OPTIONS_TABLE_FLAG,
@@ -1382,7 +1379,7 @@ extern struct mode_key_tree mode_key_tree_emacs_edit;
extern struct mode_key_tree mode_key_tree_emacs_choice;
extern struct mode_key_tree mode_key_tree_emacs_copy;
int mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *);
-SPLAY_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
+RB_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
const char *mode_key_tostring(const struct mode_key_cmdstr *,
enum mode_key_cmd);
enum mode_key_cmd mode_key_fromstring(const struct mode_key_cmdstr *,
@@ -1394,7 +1391,7 @@ enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int);
/* options.c */
int options_cmp(struct options_entry *, struct options_entry *);
-SPLAY_PROTOTYPE(options_tree, options_entry, entry, options_cmp);
+RB_PROTOTYPE(options_tree, options_entry, entry, options_cmp);
void options_init(struct options *, struct options *);
void options_free(struct options *);
struct options_entry *options_find1(struct options *, const char *);
@@ -1406,9 +1403,6 @@ char *options_get_string(struct options *, const char *);
struct options_entry *options_set_number(
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 *));
-void *options_get_data(struct options *, const char *);
/* options-table.c */
extern const struct options_table_entry server_options_table[];
@@ -1558,7 +1552,7 @@ int cmd_find_index(
struct winlink *cmd_find_pane(struct cmd_ctx *,
const char *, struct session **, struct window_pane **);
char *cmd_template_replace(char *, const char *, int);
-char *cmd_get_default_path(struct cmd_ctx *ctx);
+const char *cmd_get_default_path(struct cmd_ctx *ctx);
extern const struct cmd_entry *cmd_table[];
extern const struct cmd_entry cmd_attach_session_entry;
extern const struct cmd_entry cmd_bind_key_entry;
@@ -1659,7 +1653,7 @@ int client_main(int, char **, int);
/* key-bindings.c */
extern struct key_bindings key_bindings;
int key_bindings_cmp(struct key_binding *, struct key_binding *);
-SPLAY_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
+RB_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
struct key_binding *key_bindings_lookup(int);
void key_bindings_add(int, int, struct cmd_list *);
void key_bindings_remove(int);
@@ -1825,6 +1819,7 @@ char *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
void screen_write_start(
struct screen_write_ctx *, struct window_pane *, struct screen *);
void screen_write_stop(struct screen_write_ctx *);
+void screen_write_reset(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 *, ...);
View
15 tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c 2586 2011-08-25 21:12:52Z tcunha $ */
+/* $Id: tty.c 2668 2012-01-21 19:33:45Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -969,7 +969,10 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
* move as far left as possible and redraw the last
* cell to move into the last position.
*/
- cx = screen_size_x(s) - width;
+ if (ctx->last_cell.flags & GRID_FLAG_UTF8)
+ cx = screen_size_x(s) - ctx->last_utf8.width;
+ else
+ cx = screen_size_x(s) - 1;
tty_cursor_pane(tty, ctx, cx, ctx->ocy);
tty_cell(tty, &ctx->last_cell, &ctx->last_utf8);
}
@@ -1437,7 +1440,7 @@ tty_check_bg(struct tty *tty, struct grid_cell *gc)
/* Is this an aixterm colour? */
colours = tty_term_number(tty->term, TTYC_COLORS);
- if (gc->bg >= 100 && gc->bg <= 107 && colours < 16) {
+ if (gc->bg >= 90 && gc->bg <= 97 && colours < 16) {
gc->bg -= 90;
gc->attr |= GRID_ATTR_BRIGHT;
}
@@ -1497,14 +1500,14 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
}
/* Is this an aixterm bright colour? */
- if (bg >= 100 && bg <= 107) {
+ if (bg >= 90 && bg <= 97) {
/* 16 colour terminals or above only. */
if (tty_term_number(tty->term, TTYC_COLORS) >= 16) {
- xsnprintf(s, sizeof s, "\033[%dm", bg);
+ xsnprintf(s, sizeof s, "\033[%dm", bg + 10);
tty_puts(tty, s);
goto save_bg;
}
- bg -= 100;
+ bg -= 90;
/* no such thing as a bold background */
}
View
6 window.c
@@ -1,4 +1,4 @@
-/* $Id: window.c 2638 2011-11-25 13:30:45Z tcunha $ */
+/* $Id: window.c 2658 2012-01-20 20:18:20Z nicm $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -681,6 +681,10 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
if (tio != NULL)
memcpy(tio2.c_cc, tio->c_cc, sizeof tio2.c_cc);
tio2.c_cc[VERASE] = '\177';
+#ifdef IUTF8
+ if (options_get_number(&wp->window->options, "utf8"))
+ tio2.c_iflag |= IUTF8;
+#endif
if (tcsetattr(STDIN_FILENO, TCSANOW, &tio2) != 0)
fatal("tcgetattr failed");
Please sign in to comment.
Something went wrong with that request. Please try again.