Merge branch 'obsd-master'

Conflicts:
	tmux.1
	tmux.c
This commit is contained in:
Thomas Adam 2014-02-16 23:02:07 +00:00
commit b3de4a3dec
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 args *args = self->args;
struct client *c; struct client *c;
struct session *s; struct session *s = NULL;
struct winlink *wl = NULL; struct winlink *wl = NULL;
struct window *w = NULL; struct window *w = NULL;
struct window_pane *wp = 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 }, { '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD }, { '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD },
{ '\033' /* Escape */, 0, MODEKEYEDIT_SWITCHMODE }, { '\033' /* Escape */, 0, MODEKEYEDIT_SWITCHMODE },
{ '\n', 0, MODEKEYEDIT_ENTER },
{ '\r', 0, MODEKEYEDIT_ENTER }, { '\r', 0, MODEKEYEDIT_ENTER },
{ KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE }, { KEYC_BSPACE, 0, MODEKEYEDIT_BACKSPACE },
{ KEYC_DC, 0, MODEKEYEDIT_DELETE }, { KEYC_DC, 0, MODEKEYEDIT_DELETE },
@ -176,6 +177,7 @@ const struct mode_key_entry mode_key_vi_edit[] = {
{ 'X', 1, MODEKEYEDIT_BACKSPACE }, { 'X', 1, MODEKEYEDIT_BACKSPACE },
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL }, { '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL },
{ '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE }, { '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE },
{ '\n', 1, MODEKEYEDIT_ENTER },
{ '\r', 1, MODEKEYEDIT_ENTER }, { '\r', 1, MODEKEYEDIT_ENTER },
{ '^', 1, MODEKEYEDIT_STARTOFLINE }, { '^', 1, MODEKEYEDIT_STARTOFLINE },
{ 'a', 1, MODEKEYEDIT_SWITCHMODEAPPEND }, { 'a', 1, MODEKEYEDIT_SWITCHMODEAPPEND },
@ -219,6 +221,7 @@ const struct mode_key_entry mode_key_vi_choice[] = {
{ '\005' /* C-e */, 0, MODEKEYCHOICE_SCROLLDOWN }, { '\005' /* C-e */, 0, MODEKEYCHOICE_SCROLLDOWN },
{ '\006' /* C-f */, 0, MODEKEYCHOICE_PAGEDOWN }, { '\006' /* C-f */, 0, MODEKEYCHOICE_PAGEDOWN },
{ '\031' /* C-y */, 0, MODEKEYCHOICE_SCROLLUP }, { '\031' /* C-y */, 0, MODEKEYCHOICE_SCROLLUP },
{ '\n', 0, MODEKEYCHOICE_CHOOSE },
{ '\r', 0, MODEKEYCHOICE_CHOOSE }, { '\r', 0, MODEKEYCHOICE_CHOOSE },
{ 'j', 0, MODEKEYCHOICE_DOWN }, { 'j', 0, MODEKEYCHOICE_DOWN },
{ 'k', 0, MODEKEYCHOICE_UP }, { 'k', 0, MODEKEYCHOICE_UP },
@ -281,6 +284,7 @@ const struct mode_key_entry mode_key_vi_copy[] = {
{ '\025' /* C-u */, 0, MODEKEYCOPY_HALFPAGEUP }, { '\025' /* C-u */, 0, MODEKEYCOPY_HALFPAGEUP },
{ '\031' /* C-y */, 0, MODEKEYCOPY_SCROLLUP }, { '\031' /* C-y */, 0, MODEKEYCOPY_SCROLLUP },
{ '\033' /* Escape */, 0, MODEKEYCOPY_CLEARSELECTION }, { '\033' /* Escape */, 0, MODEKEYCOPY_CLEARSELECTION },
{ '\n', 0, MODEKEYCOPY_COPYSELECTION },
{ '\r', 0, MODEKEYCOPY_COPYSELECTION }, { '\r', 0, MODEKEYCOPY_COPYSELECTION },
{ '^', 0, MODEKEYCOPY_BACKTOINDENTATION }, { '^', 0, MODEKEYCOPY_BACKTOINDENTATION },
{ 'b', 0, MODEKEYCOPY_PREVIOUSWORD }, { 'b', 0, MODEKEYCOPY_PREVIOUSWORD },
@ -329,6 +333,7 @@ const struct mode_key_entry mode_key_emacs_edit[] = {
{ '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD }, { '\027' /* C-w */, 0, MODEKEYEDIT_DELETEWORD },
{ '\031' /* C-y */, 0, MODEKEYEDIT_PASTE }, { '\031' /* C-y */, 0, MODEKEYEDIT_PASTE },
{ '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL }, { '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL },
{ '\n', 0, MODEKEYEDIT_ENTER },
{ '\r', 0, MODEKEYEDIT_ENTER }, { '\r', 0, MODEKEYEDIT_ENTER },
{ 'b' | KEYC_ESCAPE, 0, MODEKEYEDIT_PREVIOUSWORD }, { 'b' | KEYC_ESCAPE, 0, MODEKEYEDIT_PREVIOUSWORD },
{ 'f' | KEYC_ESCAPE, 0, MODEKEYEDIT_NEXTWORDEND }, { '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 }, { '\020' /* C-p */, 0, MODEKEYCHOICE_UP },
{ '\026' /* C-v */, 0, MODEKEYCHOICE_PAGEDOWN }, { '\026' /* C-v */, 0, MODEKEYCHOICE_PAGEDOWN },
{ '\033' /* Escape */, 0, MODEKEYCHOICE_CANCEL }, { '\033' /* Escape */, 0, MODEKEYCHOICE_CANCEL },
{ '\n', 0, MODEKEYCHOICE_CHOOSE },
{ '\r', 0, MODEKEYCHOICE_CHOOSE }, { '\r', 0, MODEKEYCHOICE_CHOOSE },
{ 'q', 0, MODEKEYCHOICE_CANCEL }, { 'q', 0, MODEKEYCHOICE_CANCEL },
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCHOICE_PAGEUP }, { '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"); interval = options_get_number(&s->options, "status-interval");
difference = tv.tv_sec - c->status_timer.tv_sec; difference = tv.tv_sec - c->status_timer.tv_sec;
if (difference >= interval) { if (interval != 0 && difference >= interval) {
status_update_jobs(c); status_update_jobs(c);
c->flags |= CLIENT_STATUS; c->flags |= CLIENT_STATUS;
} }

View File

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

View File

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

6
tmux.1
View File

@ -2503,7 +2503,7 @@ Display
will be passed through will be passed through
.Xr strftime 3 .Xr strftime 3
and formats (see and formats (see
.Sx FORMATS Ns ) .Sx FORMATS )
will be expanded. will be expanded.
It may also contain any of the following special character sequences: It may also contain any of the following special character sequences:
.Bl -column "Character pair" "Replaced with" -offset indent .Bl -column "Character pair" "Replaced with" -offset indent
@ -2641,9 +2641,9 @@ The terminal entry value is passed through
before interpretation. before interpretation.
The default value forcibly corrects the The default value forcibly corrects the
.Ql colors .Ql colors
entry for terminals which support 88 or 256 colours: entry for terminals which support 256 colours:
.Bd -literal -offset indent .Bd -literal -offset indent
"*88col*:colors=88,*256col*:colors=256,xterm*:XT" "*256col*:colors=256,xterm*:XT"
.Ed .Ed
.It Ic update-environment Ar variables .It Ic update-environment Ar variables
Set a space-separated string containing a list of environment variables to be 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; 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. */ /* Try to parse a key with an xterm-style modifier. */
switch (xterm_keys_find(buf, len, &size, &key)) { switch (xterm_keys_find(buf, len, &size, &key)) {
case 0: /* found */ case 0: /* found */
@ -489,15 +498,6 @@ tty_keys_next(struct tty *tty)
goto partial_key; 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: first_key:
/* Is this a meta key? */ /* Is this a meta key? */
if (len >= 2 && buf[0] == '\033') { 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]; char s[32];
if (!(tty->term->flags & TERM_256COLOURS) && /*
!(tty->term_flags & TERM_256COLOURS)) * If the terminfo entry has 256 colours, assume that setaf and setab
return (-1); * 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); xsnprintf(s, sizeof s, "\033[%s;5;%hhum", type, colour);
tty_puts(tty, s); tty_puts(tty, s);
return (0); return (0);
} }
return (-1);
}
void void
tty_bell(struct tty *tty) 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; pos = 0;
do { do {
if (*template != '_' && buf[pos] != *template) if (*template == '_' && buf[pos] >= '1' && buf[pos] <= '8')
continue;
if (buf[pos] != *template)
return (-1); return (-1);
} while (*++template != '\0' && ++pos != len); } while (*++template != '\0' && ++pos != len);