Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code

This commit is contained in:
Nicholas Marriott 2014-02-17 18:09:25 +00:00
commit d325104d10
14 changed files with 90 additions and 67 deletions

View File

@ -61,7 +61,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
struct client *c;
struct session *s;
struct session *s = NULL;
struct winlink *wl = NULL;
struct window *w = NULL;
struct window_pane *wp = NULL;

View File

@ -153,6 +153,7 @@ const struct mode_key_entry mode_key_vi_edit[] = {
{ '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD },
{ '\033' /* Escape */, 0, MODEKEYEDIT_SWITCHMODE },
{ '\n', 0, MODEKEYEDIT_ENTER },
{ '\r', 0, MODEKEYEDIT_ENTER },
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE },
{ KEYC_DC, 0, MODEKEYEDIT_DELETE },
@ -176,6 +177,7 @@ const struct mode_key_entry mode_key_vi_edit[] = {
{ 'X', 1, MODEKEYEDIT_BACKSPACE },
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL },
{ '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE },
{ '\n', 1, MODEKEYEDIT_ENTER },
{ '\r', 1, MODEKEYEDIT_ENTER },
{ '^', 1, MODEKEYEDIT_STARTOFLINE },
{ 'a', 1, MODEKEYEDIT_SWITCHMODEAPPEND },
@ -219,6 +221,7 @@ const struct mode_key_entry mode_key_vi_choice[] = {
{ '\005' /* C-e */, 0, MODEKEYCHOICE_SCROLLDOWN },
{ '\006' /* C-f */, 0, MODEKEYCHOICE_PAGEDOWN },
{ '\031' /* C-y */, 0, MODEKEYCHOICE_SCROLLUP },
{ '\n', 0, MODEKEYCHOICE_CHOOSE },
{ '\r', 0, MODEKEYCHOICE_CHOOSE },
{ 'j', 0, MODEKEYCHOICE_DOWN },
{ 'k', 0, MODEKEYCHOICE_UP },
@ -281,6 +284,7 @@ const struct mode_key_entry mode_key_vi_copy[] = {
{ '\025' /* C-u */, 0, MODEKEYCOPY_HALFPAGEUP },
{ '\031' /* C-y */, 0, MODEKEYCOPY_SCROLLUP },
{ '\033' /* Escape */, 0, MODEKEYCOPY_CLEARSELECTION },
{ '\n', 0, MODEKEYCOPY_COPYSELECTION },
{ '\r', 0, MODEKEYCOPY_COPYSELECTION },
{ '^', 0, MODEKEYCOPY_BACKTOINDENTATION },
{ 'b', 0, MODEKEYCOPY_PREVIOUSWORD },
@ -329,6 +333,7 @@ const struct mode_key_entry mode_key_emacs_edit[] = {
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD },
{ '\031' /* C-y */, 0, MODEKEYEDIT_PASTE },
{ '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL },
{ '\n', 0, MODEKEYEDIT_ENTER },
{ '\r', 0, MODEKEYEDIT_ENTER },
{ 'b' | KEYC_ESCAPE, 0, MODEKEYEDIT_PREVIOUSWORD },
{ 'f' | KEYC_ESCAPE, 0, MODEKEYEDIT_NEXTWORDEND },
@ -363,6 +368,7 @@ const struct mode_key_entry mode_key_emacs_choice[] = {
{ '\020' /* C-p */, 0, MODEKEYCHOICE_UP },
{ '\026' /* C-v */, 0, MODEKEYCHOICE_PAGEDOWN },
{ '\033' /* Escape */, 0, MODEKEYCHOICE_CANCEL },
{ '\n', 0, MODEKEYCHOICE_CHOOSE },
{ '\r', 0, MODEKEYCHOICE_CHOOSE },
{ 'q', 0, MODEKEYCHOICE_CANCEL },
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCHOICE_PAGEUP },

View File

@ -279,7 +279,7 @@ server_client_status_timer(void)
interval = options_get_number(&s->options, "status-interval");
difference = tv.tv_sec - c->status_timer.tv_sec;
if (difference >= interval) {
if (interval != 0 && difference >= interval) {
status_update_jobs(c);
c->flags |= CLIENT_STATUS;
}

View File

@ -76,7 +76,7 @@ server_window_check_bell(struct session *s, struct winlink *wl)
wl->flags |= WINLINK_BELL;
if (s->flags & SESSION_UNATTACHED)
return (0);
if (s->curw->window == wl->window)
if (s->curw->window == w)
w->flags &= ~WINDOW_BELL;
visual = options_get_number(&s->options, "visual-bell");
@ -93,10 +93,8 @@ server_window_check_bell(struct session *s, struct winlink *wl)
}
if (c->session->curw->window == w)
status_message_set(c, "Bell in current window");
else if (action == BELL_ANY) {
status_message_set(c, "Bell in window %u",
winlink_find_by_window(&s->windows, w)->idx);
}
else if (action == BELL_ANY)
status_message_set(c, "Bell in window %u", wl->idx);
}
return (1);
@ -110,7 +108,7 @@ server_window_check_activity(struct session *s, struct winlink *wl)
struct window *w = wl->window;
u_int i;
if (s->curw->window == wl->window)
if (s->curw->window == w)
w->flags &= ~WINDOW_ACTIVITY;
if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_ACTIVITY)
@ -130,8 +128,7 @@ server_window_check_activity(struct session *s, struct winlink *wl)
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s)
continue;
status_message_set(c, "Activity in window %u",
winlink_find_by_window(&s->windows, w)->idx);
status_message_set(c, "Activity in window %u", wl->idx);
}
}
@ -182,8 +179,7 @@ server_window_check_silence(struct session *s, struct winlink *wl)
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s)
continue;
status_message_set(c, "Silence in window %u",
winlink_find_by_window(&s->windows, w)->idx);
status_message_set(c, "Silence in window %u", wl->idx);
}
}
@ -225,8 +221,7 @@ server_window_check_content(
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s)
continue;
status_message_set(c, "Content in window %u",
winlink_find_by_window(&s->windows, w)->idx);
status_message_set(c, "Content in window %u", wl->idx);
}
}

View File

@ -445,11 +445,11 @@ status_replace(struct client *c, struct session *s, struct winlink *wl,
if (fmt == NULL)
return (xstrdup(""));
if (s == NULL)
if (s == NULL && c != NULL)
s = c->session;
if (wl == NULL)
if (wl == NULL && s != NULL)
wl = s->curw;
if (wp == NULL)
if (wp == NULL && wl != NULL)
wp = wl->window->active;
len = strftime(in, sizeof in, fmt, localtime(&t));
@ -472,9 +472,13 @@ status_replace(struct client *c, struct session *s, struct winlink *wl,
*optr = '\0';
ft = format_create();
if (c != NULL)
format_client(ft, c);
if (s != NULL)
format_session(ft, s);
if (s != NULL && wl != NULL)
format_winlink(ft, s, wl);
if (wp != NULL)
format_window_pane(ft, wp);
expanded = format_expand(ft, out);
format_free(ft);

6
tmux.1
View File

@ -2503,7 +2503,7 @@ Display
will be passed through
.Xr strftime 3
and formats (see
.Sx FORMATS Ns )
.Sx FORMATS )
will be expanded.
It may also contain any of the following special character sequences:
.Bl -column "Character pair" "Replaced with" -offset indent
@ -2641,9 +2641,9 @@ The terminal entry value is passed through
before interpretation.
The default value forcibly corrects the
.Ql colors
entry for terminals which support 88 or 256 colours:
entry for terminals which support 256 colours:
.Bd -literal -offset indent
"*88col*:colors=88,*256col*:colors=256,xterm*:XT"
"*256col*:colors=256,xterm*:XT"
.Ed
.It Ic update-environment Ar variables
Set a space-separated string containing a list of environment variables to be

View File

@ -479,6 +479,15 @@ tty_keys_next(struct tty *tty)
goto partial_key;
}
/* Look for matching key string and return if found. */
tk = tty_keys_find(tty, buf, len, &size);
if (tk != NULL) {
if (tk->next != NULL)
goto partial_key;
key = tk->key;
goto complete_key;
}
/* Try to parse a key with an xterm-style modifier. */
switch (xterm_keys_find(buf, len, &size, &key)) {
case 0: /* found */
@ -489,15 +498,6 @@ tty_keys_next(struct tty *tty)
goto partial_key;
}
/* Look for matching key string and return if found. */
tk = tty_keys_find(tty, buf, len, &size);
if (tk != NULL) {
if (tk->next != NULL)
goto partial_key;
key = tk->key;
goto complete_key;
}
first_key:
/* Is this a meta key? */
if (len >= 2 && buf[0] == '\033') {

22
tty.c
View File

@ -1581,15 +1581,31 @@ tty_try_256(struct tty *tty, u_char colour, const char *type)
{
char s[32];
if (!(tty->term->flags & TERM_256COLOURS) &&
!(tty->term_flags & TERM_256COLOURS))
return (-1);
/*
* If the terminfo entry has 256 colours, assume that setaf and setab
* work correctly.
*/
if (tty->term->flags & TERM_256COLOURS) {
if (*type == '3')
tty_putcode1(tty, TTYC_SETAF, colour);
else
tty_putcode1(tty, TTYC_SETAB, colour);
return (0);
}
/*
* If the user has specified -2 to the client, setaf and setab may not
* work, so send the usual sequence.
*/
if (tty->term_flags & TERM_256COLOURS) {
xsnprintf(s, sizeof s, "\033[%s;5;%hhum", type, colour);
tty_puts(tty, s);
return (0);
}
return (-1);
}
void
tty_bell(struct tty *tty)
{

View File

@ -131,7 +131,9 @@ xterm_keys_match(const char *template, const char *buf, size_t len)
pos = 0;
do {
if (*template != '_' && buf[pos] != *template)
if (*template == '_' && buf[pos] >= '1' && buf[pos] <= '8')
continue;
if (buf[pos] != *template)
return (-1);
} while (*++template != '\0' && ++pos != len);