Permalink
Browse files

Import upstream snapshot from SVN r2670

  • Loading branch information...
1 parent 4ecaa51 commit 0f2e33647f9310958c3ba62ff459f08eeff441e3 @rfrancoise rfrancoise committed Jan 21, 2012
Showing with 480 additions and 252 deletions.
  1. +3 −1 cmd-attach-session.c
  2. +3 −3 cmd-bind-key.c
  3. +3 −3 cmd-capture-pane.c
  4. +6 −6 cmd-list-keys.c
  5. +3 −2 cmd-new-window.c
  6. +21 −3 cmd-send-keys.c
  7. +9 −6 cmd-send-prefix.c
  8. +12 −24 cmd-set-option.c
  9. +3 −3 cmd-split-window.c
  10. +2 −1 cmd-switch-client.c
  11. +5 −5 cmd-unbind-key.c
  12. +10 −3 cmd.c
  13. +41 −1 colour.c
  14. +30 −13 input.c
  15. +10 −10 key-bindings.c
  16. +5 −1 key-string.c
  17. +11 −5 mode-key.c
  18. +50 −18 options-table.c
  19. +12 −53 options.c
  20. +19 −1 screen-write.c
  21. +9 −11 server-client.c
  22. +8 −6 server-window.c
  23. +41 −9 status.c
  24. +133 −28 tmux.1
  25. +1 −8 tmux.c
  26. +16 −21 tmux.h
  27. +9 −6 tty.c
  28. +5 −1 window.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
@@ -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,14 +107,14 @@ 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);
}
mbind = xmalloc(sizeof *mbind);
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
Oops, something went wrong.

0 comments on commit 0f2e336

Please sign in to comment.