Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2015-12-11 13:24:45 +00:00
commit 4909a70174
25 changed files with 34 additions and 28 deletions

View File

@ -93,7 +93,7 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
}
if (cflag != NULL) {
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s,
NULL, NULL);
cwd = format_expand(ft, cflag);

View File

@ -101,7 +101,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = BREAK_PANE_TEMPLATE;
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), dst_s, wl,
wp);

View File

@ -88,7 +88,7 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
if (template == NULL)
template = DISPLAY_MESSAGE_TEMPLATE;
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, c, s, wl, wp);
msg = format_expand_time(ft, template, time(NULL));

View File

@ -86,7 +86,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
cwd = NULL;
}
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, NULL, s, wl, wp);
shellcmd = format_expand(ft, args->argv[0]);
format_free(ft);

View File

@ -54,7 +54,7 @@ cmd_list_buffers_exec(struct cmd *self, struct cmd_q *cmdq)
pb = NULL;
while ((pb = paste_walk(pb)) != NULL) {
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults_paste_buffer(ft, pb);
line = format_expand(ft, template);

View File

@ -69,7 +69,7 @@ cmd_list_clients_exec(struct cmd *self, struct cmd_q *cmdq)
if (c->session == NULL || (s != NULL && s != c->session))
continue;
ft = format_create(0);
ft = format_create(cmdq, 0);
format_add(ft, "line", "%u", idx);
format_defaults(ft, c, NULL, NULL, NULL);

View File

@ -125,7 +125,7 @@ cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl,
n = 0;
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
ft = format_create(0);
ft = format_create(cmdq, 0);
format_add(ft, "line", "%u", n);
format_defaults(ft, NULL, s, wl, wp);

View File

@ -61,7 +61,7 @@ cmd_list_sessions_exec(struct cmd *self, struct cmd_q *cmdq)
n = 0;
RB_FOREACH(s, sessions, &sessions) {
ft = format_create(0);
ft = format_create(cmdq, 0);
format_add(ft, "line", "%u", n);
format_defaults(ft, NULL, s, NULL, NULL);

View File

@ -105,7 +105,7 @@ cmd_list_windows_session(
n = 0;
RB_FOREACH(wl, winlinks, &s->windows) {
ft = format_create(0);
ft = format_create(cmdq, 0);
format_add(ft, "line", "%u", n);
format_defaults(ft, NULL, s, wl, NULL);

View File

@ -119,7 +119,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
/* Get the new session working directory. */
to_free = NULL;
if (args_has(args, 'c')) {
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), NULL, NULL,
NULL);
to_free = cwd = format_expand(ft, args_get(args, 'c'));
@ -283,7 +283,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = NEW_SESSION_TEMPLATE;
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, NULL,
NULL);

View File

@ -94,7 +94,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
to_free = NULL;
if (args_has(args, 'c')) {
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, NULL,
NULL);
cwd = to_free = format_expand(ft, args_get(args, 'c'));
@ -143,7 +143,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = NEW_WINDOW_TEMPLATE;
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, wl,
NULL);

View File

@ -88,7 +88,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq)
}
/* Expand the command. */
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, c, s, wl, wp);
cmd = format_expand_time(ft, args->argv[0], time(NULL));
format_free(ft);

View File

@ -100,7 +100,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq)
cwd = NULL;
}
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, NULL, s, wl, wp);
shellcmd = format_expand(ft, args->argv[0]);
format_free(ft);

View File

@ -87,7 +87,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
to_free = NULL;
if (args_has(args, 'c')) {
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, NULL,
NULL);
to_free = cwd = format_expand(ft, args_get(args, 'c'));
@ -164,7 +164,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
if ((template = args_get(args, 'F')) == NULL)
template = SPLIT_WINDOW_TEMPLATE;
ft = format_create(0);
ft = format_create(cmdq, 0);
format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, wl,
new_wp);

View File

@ -131,6 +131,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
server_check_unattached();
server_redraw_client(c);
s->curw->flags &= ~WINLINK_ALERTFLAGS;
alerts_check_session(s);
return (CMD_RETURN_NORMAL);
}

View File

@ -88,7 +88,7 @@ control_notify_window_layout_changed(struct window *w)
if (w->layout_root == NULL)
continue;
ft = format_create(0);
ft = format_create(NULL, 0);
wl = winlink_find_by_window(&s->windows, w);
if (wl != NULL) {
format_defaults(ft, c, NULL, wl, NULL);

View File

@ -482,7 +482,7 @@ format_cb_pane_tabs(struct format_tree *ft, struct format_entry *fe)
/* Create a new tree. */
struct format_tree *
format_create(int flags)
format_create(struct cmd_q *cmdq, int flags)
{
struct format_tree *ft;
@ -501,6 +501,9 @@ format_create(int flags)
format_add(ft, "socket_path", "%s", socket_path);
format_add_tv(ft, "start_time", &start_time);
if (cmdq != NULL && cmdq->cmd != NULL)
format_add(ft, "command_name", "%s", cmdq->cmd->entry->name);
return (ft);
}

View File

@ -118,7 +118,7 @@ format_window_name(struct window *w)
struct format_tree *ft;
char *fmt, *name;
ft = format_create(0);
ft = format_create(NULL, 0);
format_defaults_window(ft, w);
format_defaults_pane(ft, w->active);

View File

@ -941,7 +941,7 @@ server_client_set_title(struct client *c)
template = options_get_string(s->options, "set-titles-string");
ft = format_create(0);
ft = format_create(NULL, 0);
format_defaults(ft, c, NULL, NULL, NULL);
title = format_expand_time(ft, template, time(NULL));

View File

@ -390,6 +390,7 @@ server_destroy_session(struct session *s)
session_update_activity(s_new, NULL);
gettimeofday(&s_new->last_attached_time, NULL);
server_redraw_client(c);
alerts_check_session(s_new);
}
}
recalculate_sizes();

View File

@ -500,9 +500,9 @@ status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t)
return (xstrdup(""));
if (c->flags & CLIENT_STATUSFORCE)
ft = format_create(FORMAT_STATUS|FORMAT_FORCE);
ft = format_create(NULL, FORMAT_STATUS|FORMAT_FORCE);
else
ft = format_create(FORMAT_STATUS);
ft = format_create(NULL, FORMAT_STATUS);
format_defaults(ft, c, NULL, wl, NULL);
expanded = format_expand_time(ft, fmt, t);
@ -661,7 +661,7 @@ status_prompt_set(struct client *c, const char *msg, const char *input,
int keys;
time_t t;
ft = format_create(0);
ft = format_create(NULL, 0);
format_defaults(ft, c, NULL, NULL, NULL);
t = time(NULL);
@ -722,7 +722,7 @@ status_prompt_update(struct client *c, const char *msg, const char *input)
struct format_tree *ft;
time_t t;
ft = format_create(0);
ft = format_create(NULL, 0);
format_defaults(ft, c, NULL, NULL, NULL);
t = time(NULL);

1
tmux.1
View File

@ -3410,6 +3410,7 @@ The following variables are available, where appropriate:
.It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
.It Li "client_utf8" Ta "" Ta "1 if client supports utf8"
.It Li "client_width" Ta "" Ta "Width of client"
.It Li "command_name" Ta "" Ta "Name of command in use, if any"
.It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
.It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
.It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"

2
tmux.h
View File

@ -1494,7 +1494,7 @@ char *paste_make_sample(struct paste_buffer *);
#define FORMAT_STATUS 0x1
#define FORMAT_FORCE 0x2
struct format_tree;
struct format_tree *format_create(int);
struct format_tree *format_create(struct cmd_q *, int);
void format_free(struct format_tree *);
void printflike(3, 4) format_add(struct format_tree *, const char *,
const char *, ...);

View File

@ -186,7 +186,7 @@ window_choose_data_create(int type, struct client *c, struct session *s)
wcd = xmalloc(sizeof *wcd);
wcd->type = type;
wcd->ft = format_create(0);
wcd->ft = format_create(NULL, 0);
wcd->ft_template = NULL;
wcd->command = NULL;

View File

@ -1480,7 +1480,7 @@ window_copy_copy_pipe(struct window_pane *wp, struct session *sess,
if (buf == NULL)
return;
ft = format_create(0);
ft = format_create(NULL, 0);
format_defaults(ft, NULL, sess, NULL, wp);
expanded = format_expand(ft, arg);