Skip to content

Commit

Permalink
Import upstream snapshot from SVN r2642
Browse files Browse the repository at this point in the history
  • Loading branch information
rfrancoise committed Nov 25, 2011
1 parent c2acb99 commit d873474
Show file tree
Hide file tree
Showing 15 changed files with 235 additions and 72 deletions.
2 changes: 2 additions & 0 deletions TODO
Expand Up @@ -140,6 +140,8 @@
- fetch full command line on !Linux, and add option to strip prefixes
such as "sh " "/bin/sh " etc etc
- synchronize-windows option
- possibly support rxvt-unicode extended mouse input (1015)
- append to buffer in copy mode
* We need a tmux terminfo entry to document the extensions we are using in
upstream terminfo. Must NOT change (only add or remove) anything from
TERM=screen so we can fallback!
8 changes: 4 additions & 4 deletions cmd-list-panes.c
@@ -1,4 +1,4 @@
/* $Id: cmd-list-panes.c 2591 2011-09-21 16:31:15Z tcunha $ */
/* $Id: cmd-list-panes.c 2639 2011-11-25 13:31:56Z tcunha $ */

/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
Expand Down Expand Up @@ -102,21 +102,21 @@ cmd_list_panes_window(struct cmd *self,
if (template == NULL) {
switch (type) {
case 0:
template = "#{line}: "
template = "#{pane_index}: "
"[#{pane_width}x#{pane_height}] [history "
"#{history_size}/#{history_limit}, "
"#{history_bytes} bytes] #{pane_id}"
"#{?pane_active, (active),}#{?pane_dead, (dead),}";
break;
case 1:
template = "#{window_index}.#{line}: "
template = "#{window_index}.#{pane_index}: "
"[#{pane_width}x#{pane_height}] [history "
"#{history_size}/#{history_limit}, "
"#{history_bytes} bytes] #{pane_id}"
"#{?pane_active, (active),}#{?pane_dead, (dead),}";
break;
case 2:
template = "#{session_name}:#{window_index}.#{line}: "
template = "#{session_name}:#{window_index}.#{pane_index}: "
"[#{pane_width}x#{pane_height}] [history "
"#{history_size}/#{history_limit}, "
"#{history_bytes} bytes] #{pane_id}"
Expand Down
9 changes: 6 additions & 3 deletions cmd-respawn-pane.c
@@ -1,4 +1,4 @@
/* $Id: cmd-respawn-pane.c 2553 2011-07-09 09:42:33Z tcunha $ */
/* $Id: cmd-respawn-pane.c 2638 2011-11-25 13:30:45Z tcunha $ */

/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
Expand Down Expand Up @@ -49,15 +49,18 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
struct session *s;
struct environ env;
const char *cmd;
char *cause;
char *cause;
u_int idx;

if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL)
return (-1);
w = wl->window;

if (!args_has(self->args, 'k') && wp->fd != -1) {
if (window_pane_index(wp, &idx) != 0)
fatalx("index not found");
ctx->error(ctx, "pane still active: %s:%u.%u",
s->name, wl->idx, window_pane_index(w, wp));
s->name, wl->idx, idx);
return (-1);
}

Expand Down
5 changes: 3 additions & 2 deletions cmd-split-window.c
@@ -1,4 +1,4 @@
/* $Id: cmd-split-window.c 2594 2011-09-21 16:34:04Z tcunha $ */
/* $Id: cmd-split-window.c 2638 2011-11-25 13:30:45Z tcunha $ */

/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
Expand Down Expand Up @@ -139,7 +139,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx)
environ_free(&env);

if (args_has(args, 'P')) {
paneidx = window_pane_index(wl->window, new_wp);
if (window_pane_index(new_wp, &paneidx) != 0)
fatalx("index not found");
ctx->print(ctx, "%s:%u.%u", s->name, wl->idx, paneidx);
}
return (0);
Expand Down
19 changes: 11 additions & 8 deletions examples/tmux.vim
Expand Up @@ -47,21 +47,23 @@ syn keyword tmuxCmds capture-pane joinp join-pane choose-buffer
syn keyword tmuxOptsSet prefix status status-fg status-bg bell-action
syn keyword tmuxOptsSet default-command history-limit status-left status-right
syn keyword tmuxOptsSet status-interval set-titles display-time buffer-limit
syn keyword tmuxOptsSet status-left-length status-right-length message-fg
syn keyword tmuxOptsSet message-bg lock-after-time default-path repeat-time
syn keyword tmuxOptsSet message-attr status-attr status-keys set-remain-on-exit
syn keyword tmuxOptsSet status-utf8 default-terminal visual-activity
syn keyword tmuxOptsSet visual-bell visual-content status-justify
syn keyword tmuxOptsSet status-left-length status-right-length
syn keyword tmuxOptsSet message-[command-]bg lock-after-time default-path
syn keyword tmuxOptsSet message-[command-]attr status-attr set-remain-on-exit
syn keyword tmuxOptsSet status-utf8 default-terminal visual-activity repeat-time
syn keyword tmuxOptsSet visual-bell visual-content status-justify status-keys
syn keyword tmuxOptsSet terminal-overrides status-left-attr status-left-bg
syn keyword tmuxOptsSet status-left-fg status-right-attr status-right-bg
syn keyword tmuxOptsSet status-right-fg update-environment base-index
syn keyword tmuxOptsSet display-panes-colour display-panes-time default-shell
syn keyword tmuxOptsSet set-titles-string lock-command lock-server
syn keyword tmuxOptsSet mouse-select-pane message-limit quiet escape-time
syn keyword tmuxOptsSet pane-active-border-bg pane-active-border-fg
syn keyword tmuxOptsSet pane-border-bg pane-border-fg
syn keyword tmuxOptsSet pane-border-bg pane-border-fg message-[command-]fg
syn keyword tmuxOptsSet display-panes-active-colour alternate-screen
syn keyword tmuxOptsSet detach-on-destroy
syn keyword tmuxOptsSet detach-on-destroy word-separators
syn keyword tmuxOptsSet destroy-unattached exit-unattached set-clipboard
syn keyword tmuxOptsSet bell-on-alert mouse-select-window mouse-utf8

syn keyword tmuxOptsSetw monitor-activity aggressive-resize force-width
syn keyword tmuxOptsSetw force-height remain-on-exit uft8 mode-fg mode-bg
Expand All @@ -72,8 +74,9 @@ syn keyword tmuxOptsSetw main-pane-width main-pane-height monitor-content
syn keyword tmuxOptsSetw window-status-current-attr window-status-current-bg
syn keyword tmuxOptsSetw window-status-current-fg mode-mouse synchronize-panes
syn keyword tmuxOptsSetw window-status-format window-status-current-format
syn keyword tmuxOptsSetw word-separators window-status-alert-alert
syn keyword tmuxOptsSetw window-status-alert-attr
syn keyword tmuxOptsSetw window-status-alert-bg window-status-alert-fg
syn keyword tmuxOptsSetw pane-base-index other-pane-height other-pane-width

syn keyword tmuxTodo FIXME NOTE TODO XXX contained

Expand Down
5 changes: 5 additions & 0 deletions format.c
Expand Up @@ -361,6 +361,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
struct grid_line *gl;
unsigned long long size;
u_int i;
u_int idx;

size = 0;
for (i = 0; i < gd->hsize; i++) {
Expand All @@ -370,9 +371,13 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
}
size += gd->hsize * sizeof *gd->linedata;

if (window_pane_index(wp, &idx) != 0)
fatalx("index not found");

format_add(ft, "pane_width", "%u", wp->sx);
format_add(ft, "pane_height", "%u", wp->sy);
format_add(ft, "pane_title", "%s", wp->base.title);
format_add(ft, "pane_index", "%u", idx);
format_add(ft, "history_size", "%u", gd->hsize);
format_add(ft, "history_limit", "%u", gd->hlimit);
format_add(ft, "history_bytes", "%llu", size);
Expand Down
6 changes: 3 additions & 3 deletions layout-set.c
@@ -1,4 +1,4 @@
/* $Id: layout-set.c 2553 2011-07-09 09:42:33Z tcunha $ */
/* $Id: layout-set.c 2634 2011-11-10 21:41:37Z tcunha $ */

/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
Expand Down Expand Up @@ -260,8 +260,8 @@ layout_set_main_h(struct window *w)
* If an other pane height was specified, honour it so long as it
* doesn't shrink the main height to less than the main-pane-height
*/
if (otherheight > 1 && w->sx - otherheight > mainheight)
mainheight = w->sx - otherheight;
if (otherheight > 1 && w->sy - otherheight > mainheight)
mainheight = w->sy - otherheight;
if (mainheight < PANE_MINIMUM + 1)
mainheight = PANE_MINIMUM + 1;

Expand Down
25 changes: 18 additions & 7 deletions mode-key.c
@@ -1,4 +1,4 @@
/* $Id: mode-key.c 2581 2011-08-21 12:37:26Z tcunha $ */
/* $Id: mode-key.c 2641 2011-11-25 13:34:20Z tcunha $ */

/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
Expand Down Expand Up @@ -49,11 +49,15 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
{ MODEKEYEDIT_DELETE, "delete" },
{ MODEKEYEDIT_DELETELINE, "delete-line" },
{ MODEKEYEDIT_DELETETOENDOFLINE, "delete-end-of-line" },
{ MODEKEYEDIT_DELETEWORD, "delete-word" },
{ MODEKEYEDIT_ENDOFLINE, "end-of-line" },
{ MODEKEYEDIT_ENTER, "enter" },
{ MODEKEYEDIT_HISTORYDOWN, "history-down" },
{ MODEKEYEDIT_HISTORYUP, "history-up" },
{ MODEKEYEDIT_NEXTWORD, "next-word" },
{ MODEKEYEDIT_NEXTWORDEND, "next-word-end" },
{ MODEKEYEDIT_PASTE, "paste" },
{ MODEKEYEDIT_PREVIOUSWORD, "previous-word" },
{ MODEKEYEDIT_STARTOFLINE, "start-of-line" },
{ MODEKEYEDIT_SWITCHMODE, "switch-mode" },
{ MODEKEYEDIT_SWITCHMODEAPPEND, "switch-mode-append" },
Expand Down Expand Up @@ -127,7 +131,8 @@ const struct mode_key_entry mode_key_vi_edit[] = {
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL },
{ '\010' /* C-h */, 0, MODEKEYEDIT_BACKSPACE },
{ '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE },
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD },
{ '\033' /* Escape */, 0, MODEKEYEDIT_SWITCHMODE },
{ '\r', 0, MODEKEYEDIT_ENTER },
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE },
Expand All @@ -145,13 +150,16 @@ const struct mode_key_entry mode_key_vi_edit[] = {
{ '\r', 1, MODEKEYEDIT_ENTER },
{ '^', 1, MODEKEYEDIT_STARTOFLINE },
{ 'a', 1, MODEKEYEDIT_SWITCHMODEAPPEND },
{ 'b', 1, MODEKEYEDIT_PREVIOUSWORD },
{ 'd', 1, MODEKEYEDIT_DELETELINE },
{ 'e', 1, MODEKEYEDIT_NEXTWORDEND },
{ 'h', 1, MODEKEYEDIT_CURSORLEFT },
{ 'i', 1, MODEKEYEDIT_SWITCHMODE },
{ 'j', 1, MODEKEYEDIT_HISTORYDOWN },
{ 'k', 1, MODEKEYEDIT_HISTORYUP },
{ 'l', 1, MODEKEYEDIT_CURSORRIGHT },
{ 'p', 1, MODEKEYEDIT_PASTE },
{ 'w', 1, MODEKEYEDIT_NEXTWORD },
{ KEYC_BSPACE, 1, MODEKEYEDIT_BACKSPACE },
{ KEYC_DC, 1, MODEKEYEDIT_DELETE },
{ KEYC_DOWN, 1, MODEKEYEDIT_HISTORYDOWN },
Expand Down Expand Up @@ -259,18 +267,21 @@ const struct mode_key_entry mode_key_emacs_edit[] = {
{ '\002' /* C-b */, 0, MODEKEYEDIT_CURSORLEFT },
{ '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL },
{ '\004' /* C-d */, 0, MODEKEYEDIT_DELETE },
{ '\005' /* C-e */, 0, MODEKEYEDIT_ENDOFLINE },
{ '\005' /* C-e */, 0, MODEKEYEDIT_ENDOFLINE },
{ '\006' /* C-f */, 0, MODEKEYEDIT_CURSORRIGHT },
{ '\010' /* C-H */, 0, MODEKEYEDIT_BACKSPACE },
{ '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE },
{ '\013' /* C-k */, 0, MODEKEYEDIT_DELETETOENDOFLINE },
{ '\010' /* C-H */, 0, MODEKEYEDIT_BACKSPACE },
{ '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE },
{ '\013' /* C-k */, 0, MODEKEYEDIT_DELETETOENDOFLINE },
{ '\016' /* C-n */, 0, MODEKEYEDIT_HISTORYDOWN },
{ '\020' /* C-p */, 0, MODEKEYEDIT_HISTORYUP },
{ '\024' /* C-t */, 0, MODEKEYEDIT_TRANSPOSECHARS },
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD },
{ '\031' /* C-y */, 0, MODEKEYEDIT_PASTE },
{ '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL },
{ '\r', 0, MODEKEYEDIT_ENTER },
{ 'b' | KEYC_ESCAPE, 0, MODEKEYEDIT_PREVIOUSWORD },
{ 'f' | KEYC_ESCAPE, 0, MODEKEYEDIT_NEXTWORDEND },
{ 'm' | KEYC_ESCAPE, 0, MODEKEYEDIT_STARTOFLINE },
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE },
{ KEYC_DC, 0, MODEKEYEDIT_DELETE },
Expand Down
27 changes: 21 additions & 6 deletions options-table.c
@@ -1,4 +1,4 @@
/* $Id: options-table.c 2629 2011-10-31 13:56:16Z tcunha $ */
/* $Id: options-table.c 2640 2011-11-25 13:33:04Z tcunha $ */

/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
Expand Down Expand Up @@ -193,6 +193,21 @@ const struct options_table_entry session_options_table[] = {
.default_num = 3
},

{ .name = "message-command-attr",
.type = OPTIONS_TABLE_ATTRIBUTES,
.default_num = 0
},

{ .name = "message-command-bg",
.type = OPTIONS_TABLE_COLOUR,
.default_num = 0
},

{ .name = "message-command-fg",
.type = OPTIONS_TABLE_COLOUR,
.default_num = 3
},

{ .name = "message-fg",
.type = OPTIONS_TABLE_COLOUR,
.default_num = 0
Expand Down Expand Up @@ -405,6 +420,11 @@ const struct options_table_entry session_options_table[] = {
.default_num = 0
},

{ .name = "word-separators",
.type = OPTIONS_TABLE_STRING,
.default_str = " -_@"
},

{ .name = NULL }
};

Expand Down Expand Up @@ -599,11 +619,6 @@ const struct options_table_entry window_options_table[] = {
.default_str = "#I:#W#F"
},

{ .name = "word-separators",
.type = OPTIONS_TABLE_STRING,
.default_str = " -_@"
},

{ .name = "xterm-keys",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0
Expand Down
7 changes: 4 additions & 3 deletions screen-redraw.c
@@ -1,4 +1,4 @@
/* $Id: screen-redraw.c 2553 2011-07-09 09:42:33Z tcunha $ */
/* $Id: screen-redraw.c 2638 2011-11-25 13:30:45Z tcunha $ */

/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
Expand Down Expand Up @@ -264,15 +264,16 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp)
{
struct tty *tty = &c->tty;
struct session *s = c->session;
struct options *oo = &s->options;
struct options *oo = &s->options;
struct window *w = wp->window;
struct grid_cell gc;
u_int idx, px, py, i, j, xoff, yoff;
int colour, active_colour;
char buf[16], *ptr;
size_t len;

idx = window_pane_index(w, wp);
if (window_pane_index(wp, &idx) != 0)
fatalx("index not found");
len = xsnprintf(buf, sizeof buf, "%u", idx);

if (wp->sx < len)
Expand Down

0 comments on commit d873474

Please sign in to comment.