diff options
Diffstat (limited to 'usr.bin')
26 files changed, 76 insertions, 58 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c index 29e38b63435..a86a46e7be3 100644 --- a/usr.bin/tmux/cfg.c +++ b/usr.bin/tmux/cfg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfg.c,v 1.53 2017/01/15 22:00:56 nicm Exp $ */ +/* $OpenBSD: cfg.c,v 1.54 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -123,7 +123,7 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int quiet) line); continue; } - ft = format_create(NULL, FORMAT_NOJOBS); + ft = format_create(NULL, FORMAT_NONE, FORMAT_NOJOBS); s = p + 3; while (isspace((u_char)*s)) diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c index d87e4470849..9fe022b39b4 100644 --- a/usr.bin/tmux/cmd-attach-session.c +++ b/usr.bin/tmux/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-attach-session.c,v 1.67 2017/01/28 16:11:27 nicm Exp $ */ +/* $OpenBSD: cmd-attach-session.c,v 1.68 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -77,7 +77,7 @@ cmd_attach_session(struct cmdq_item *item, int dflag, int rflag, } if (cflag != NULL) { - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, c, s, wl, wp); cwd = format_expand(ft, cflag); format_free(ft); diff --git a/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c index 9c37728707c..b1a2739e005 100644 --- a/usr.bin/tmux/cmd-break-pane.c +++ b/usr.bin/tmux/cmd-break-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-break-pane.c,v 1.41 2017/01/29 22:10:55 nicm Exp $ */ +/* $OpenBSD: cmd-break-pane.c,v 1.42 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -107,7 +107,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item) if ((template = args_get(args, 'F')) == NULL) template = BREAK_PANE_TEMPLATE; - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, item->state.c, dst_s, wl, wp); cp = format_expand(ft, template); diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c index c8b06de7c56..3e0c369100b 100644 --- a/usr.bin/tmux/cmd-display-message.c +++ b/usr.bin/tmux/cmd-display-message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-message.c,v 1.39 2016/10/16 19:04:05 nicm Exp $ */ +/* $OpenBSD: cmd-display-message.c,v 1.40 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -73,7 +73,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) if (template == NULL) template = DISPLAY_MESSAGE_TEMPLATE; - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, c, s, wl, wp); msg = format_expand_time(ft, template, time(NULL)); diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c index 9651287817d..f71b6865b5b 100644 --- a/usr.bin/tmux/cmd-if-shell.c +++ b/usr.bin/tmux/cmd-if-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-if-shell.c,v 1.49 2017/01/15 22:00:56 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.50 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -82,7 +82,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) else cwd = NULL; - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, item->state.c, s, wl, wp); shellcmd = format_expand(ft, args->argv[0]); format_free(ft); diff --git a/usr.bin/tmux/cmd-list-buffers.c b/usr.bin/tmux/cmd-list-buffers.c index 4400c3b39ed..56efd29afae 100644 --- a/usr.bin/tmux/cmd-list-buffers.c +++ b/usr.bin/tmux/cmd-list-buffers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-buffers.c,v 1.33 2016/10/16 19:04:05 nicm Exp $ */ +/* $OpenBSD: cmd-list-buffers.c,v 1.34 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -57,7 +57,7 @@ cmd_list_buffers_exec(struct cmd *self, struct cmdq_item *item) pb = NULL; while ((pb = paste_walk(pb)) != NULL) { - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults_paste_buffer(ft, pb); line = format_expand(ft, template); diff --git a/usr.bin/tmux/cmd-list-clients.c b/usr.bin/tmux/cmd-list-clients.c index a2488467cce..6e863733d21 100644 --- a/usr.bin/tmux/cmd-list-clients.c +++ b/usr.bin/tmux/cmd-list-clients.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-clients.c,v 1.30 2016/10/16 19:04:05 nicm Exp $ */ +/* $OpenBSD: cmd-list-clients.c,v 1.31 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -72,7 +72,7 @@ cmd_list_clients_exec(struct cmd *self, struct cmdq_item *item) if (c->session == NULL || (s != NULL && s != c->session)) continue; - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_add(ft, "line", "%u", idx); format_defaults(ft, c, NULL, NULL, NULL); diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index 9d49b337b36..8a378e47050 100644 --- a/usr.bin/tmux/cmd-list-keys.c +++ b/usr.bin/tmux/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-keys.c,v 1.41 2017/01/24 21:50:22 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.42 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -144,7 +144,7 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item) "#{command_list_usage}"; } - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, NULL, NULL, NULL, NULL); for (entryp = cmd_table; *entryp != NULL; entryp++) { diff --git a/usr.bin/tmux/cmd-list-panes.c b/usr.bin/tmux/cmd-list-panes.c index 04947718b07..cf51396eab5 100644 --- a/usr.bin/tmux/cmd-list-panes.c +++ b/usr.bin/tmux/cmd-list-panes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-panes.c,v 1.30 2016/10/16 19:04:05 nicm Exp $ */ +/* $OpenBSD: cmd-list-panes.c,v 1.31 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -123,7 +123,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(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_add(ft, "line", "%u", n); format_defaults(ft, NULL, s, wl, wp); diff --git a/usr.bin/tmux/cmd-list-sessions.c b/usr.bin/tmux/cmd-list-sessions.c index 8ea5559cf3e..9e3bc6578df 100644 --- a/usr.bin/tmux/cmd-list-sessions.c +++ b/usr.bin/tmux/cmd-list-sessions.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-sessions.c,v 1.27 2016/10/16 19:04:05 nicm Exp $ */ +/* $OpenBSD: cmd-list-sessions.c,v 1.28 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -65,7 +65,7 @@ cmd_list_sessions_exec(struct cmd *self, struct cmdq_item *item) n = 0; RB_FOREACH(s, sessions, &sessions) { - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_add(ft, "line", "%u", n); format_defaults(ft, NULL, s, NULL, NULL); diff --git a/usr.bin/tmux/cmd-list-windows.c b/usr.bin/tmux/cmd-list-windows.c index f6701bcdc46..1daf04a65a5 100644 --- a/usr.bin/tmux/cmd-list-windows.c +++ b/usr.bin/tmux/cmd-list-windows.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-windows.c,v 1.40 2016/10/16 19:04:05 nicm Exp $ */ +/* $OpenBSD: cmd-list-windows.c,v 1.41 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -105,7 +105,7 @@ cmd_list_windows_session(struct cmd *self, struct session *s, n = 0; RB_FOREACH(wl, winlinks, &s->windows) { - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_add(ft, "line", "%u", n); format_defaults(ft, NULL, s, wl, NULL); diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 6dd2f4992f4..cc0002082ff 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.98 2017/01/28 16:11:27 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.99 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -139,7 +139,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) /* Get the new session working directory. */ if (args_has(args, 'c')) { - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, c, NULL, NULL, NULL); to_free = cwd = format_expand(ft, args_get(args, 'c')); format_free(ft); @@ -298,7 +298,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) if ((template = args_get(args, 'F')) == NULL) template = NEW_SESSION_TEMPLATE; - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, c, s, NULL, NULL); cp = format_expand(ft, template); diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c index 2b2ad45489f..076c3881213 100644 --- a/usr.bin/tmux/cmd-new-window.c +++ b/usr.bin/tmux/cmd-new-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-window.c,v 1.65 2016/10/16 22:06:40 nicm Exp $ */ +/* $OpenBSD: cmd-new-window.c,v 1.66 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -95,7 +95,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) to_free = NULL; if (args_has(args, 'c')) { - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, c, s, NULL, NULL); cwd = to_free = format_expand(ft, args_get(args, 'c')); format_free(ft); @@ -143,7 +143,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) if ((template = args_get(args, 'F')) == NULL) template = NEW_WINDOW_TEMPLATE; - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, c, s, wl, NULL); cp = format_expand(ft, template); diff --git a/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c index 761a931558c..4eb6f567eb2 100644 --- a/usr.bin/tmux/cmd-pipe-pane.c +++ b/usr.bin/tmux/cmd-pipe-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-pipe-pane.c,v 1.39 2016/10/16 19:04:05 nicm Exp $ */ +/* $OpenBSD: cmd-pipe-pane.c,v 1.40 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -90,7 +90,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item) } /* Expand the command. */ - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, c, s, wl, wp); cmd = format_expand_time(ft, args->argv[0], time(NULL)); format_free(ft); diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c index 2c3e78dc6ea..f1f7512a7a8 100644 --- a/usr.bin/tmux/cmd-queue.c +++ b/usr.bin/tmux/cmd-queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.47 2017/01/05 09:07:15 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.48 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -268,7 +268,7 @@ cmdq_format(struct cmdq_item *item, const char *key, const char *fmt, ...) for (loop = item; loop != NULL; loop = item->next) { if (loop->formats == NULL) - loop->formats = format_create(NULL, 0); + loop->formats = format_create(NULL, FORMAT_NONE, 0); format_add(loop->formats, key, "%s", value); } diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index 8006a324ece..70d43a9b062 100644 --- a/usr.bin/tmux/cmd-run-shell.c +++ b/usr.bin/tmux/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.43 2016/11/12 19:05:53 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.44 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -100,7 +100,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item) else cwd = NULL; - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, item->state.c, s, wl, wp); shellcmd = format_expand(ft, args->argv[0]); format_free(ft); diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c index 1dafb856135..3dd9b18bdf4 100644 --- a/usr.bin/tmux/cmd-split-window.c +++ b/usr.bin/tmux/cmd-split-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-split-window.c,v 1.76 2016/10/16 22:06:40 nicm Exp $ */ +/* $OpenBSD: cmd-split-window.c,v 1.77 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -92,7 +92,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) to_free = NULL; if (args_has(args, 'c')) { - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, item->state.c, s, NULL, NULL); to_free = cwd = format_expand(ft, args_get(args, 'c')); format_free(ft); @@ -169,7 +169,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) if ((template = args_get(args, 'F')) == NULL) template = SPLIT_WINDOW_TEMPLATE; - ft = format_create(item, 0); + ft = format_create(item, FORMAT_NONE, 0); format_defaults(ft, item->state.c, s, wl, new_wp); cp = format_expand(ft, template); diff --git a/usr.bin/tmux/control-notify.c b/usr.bin/tmux/control-notify.c index 546d0a18010..888f1f78510 100644 --- a/usr.bin/tmux/control-notify.c +++ b/usr.bin/tmux/control-notify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control-notify.c,v 1.18 2016/10/16 22:06:40 nicm Exp $ */ +/* $OpenBSD: control-notify.c,v 1.19 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -88,7 +88,7 @@ control_notify_window_layout_changed(struct window *w) if (w->layout_root == NULL) continue; - ft = format_create(NULL, 0); + ft = format_create(NULL, FORMAT_NONE, 0); wl = winlink_find_by_window(&s->windows, w); if (wl != NULL) { format_defaults(ft, c, NULL, wl, NULL); diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 2aa72adc6a0..6e616fa9628 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.119 2017/02/01 09:55:07 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.120 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -77,6 +77,7 @@ static void format_defaults_winlink(struct format_tree *, struct session *, /* Entry in format job tree. */ struct format_job { + u_int tag; const char *cmd; const char *expanded; @@ -99,6 +100,10 @@ RB_GENERATE_STATIC(format_job_tree, format_job, entry, format_job_cmp); static int format_job_cmp(struct format_job *fj1, struct format_job *fj2) { + if (fj1->tag < fj2->tag) + return (-1); + if (fj1->tag > fj2->tag) + return (1); return (strcmp(fj1->cmd, fj2->cmd)); } @@ -123,6 +128,7 @@ struct format_tree { struct session *s; struct window_pane *wp; + u_int tag; int flags; RB_HEAD(format_entry_tree, format_entry) tree; @@ -238,9 +244,11 @@ format_job_get(struct format_tree *ft, const char *cmd) char *expanded; int force; + fj0.tag = ft->tag; fj0.cmd = cmd; if ((fj = RB_FIND(format_job_tree, &format_jobs, &fj0)) == NULL) { fj = xcalloc(1, sizeof *fj); + fj->tag = ft->tag; fj->cmd = xstrdup(cmd); fj->expanded = NULL; @@ -497,7 +505,7 @@ format_merge(struct format_tree *ft, struct format_tree *from) /* Create a new tree. */ struct format_tree * -format_create(struct cmdq_item *item, int flags) +format_create(struct cmdq_item *item, int tag, int flags) { struct format_tree *ft; @@ -508,6 +516,8 @@ format_create(struct cmdq_item *item, int flags) ft = xcalloc(1, sizeof *ft); RB_INIT(&ft->tree); + + ft->tag = tag; ft->flags = flags; format_add_cb(ft, "host", format_cb_host); diff --git a/usr.bin/tmux/names.c b/usr.bin/tmux/names.c index 24156a8355b..7d446b6ea04 100644 --- a/usr.bin/tmux/names.c +++ b/usr.bin/tmux/names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: names.c,v 1.38 2017/01/13 11:56:43 nicm Exp $ */ +/* $OpenBSD: names.c,v 1.39 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -124,7 +124,7 @@ format_window_name(struct window *w) const char *fmt; char *name; - ft = format_create(NULL, 0); + ft = format_create(NULL, FORMAT_WINDOW|w->id, 0); format_defaults_window(ft, w); format_defaults_pane(ft, w->active); diff --git a/usr.bin/tmux/screen-redraw.c b/usr.bin/tmux/screen-redraw.c index 3437551b77e..1eec2029205 100644 --- a/usr.bin/tmux/screen-redraw.c +++ b/usr.bin/tmux/screen-redraw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-redraw.c,v 1.42 2017/01/07 15:28:13 nicm Exp $ */ +/* $OpenBSD: screen-redraw.c,v 1.43 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -280,7 +280,7 @@ screen_redraw_make_pane_status(struct client *c, struct window *w, fmt = options_get_string(w->options, "pane-border-format"); - ft = format_create(NULL, 0); + ft = format_create(NULL, FORMAT_PANE|wp->id, 0); format_defaults(ft, c, NULL, NULL, wp); memcpy(&old, &wp->status_screen, sizeof old); diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index f2c64af1d01..9fcce74654f 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.209 2017/02/01 09:55:07 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.210 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1222,7 +1222,7 @@ server_client_set_title(struct client *c) template = options_get_string(s->options, "set-titles-string"); - ft = format_create(NULL, 0); + ft = format_create(NULL, FORMAT_NONE, 0); format_defaults(ft, c, NULL, NULL, NULL); title = format_expand_time(ft, template, time(NULL)); diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 1a436d7cef0..7a587717cf0 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.159 2017/01/13 11:56:43 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.160 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -500,14 +500,19 @@ status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t) { struct format_tree *ft; char *expanded; + u_int tag; if (fmt == NULL) return (xstrdup("")); + if (wl != NULL) + tag = FORMAT_WINDOW|wl->window->id; + else + tag = FORMAT_NONE; if (c->flags & CLIENT_STATUSFORCE) - ft = format_create(NULL, FORMAT_STATUS|FORMAT_FORCE); + ft = format_create(NULL, tag, FORMAT_STATUS|FORMAT_FORCE); else - ft = format_create(NULL, FORMAT_STATUS); + ft = format_create(NULL, tag, FORMAT_STATUS); format_defaults(ft, c, NULL, wl, NULL); expanded = format_expand_time(ft, fmt, t); @@ -665,7 +670,7 @@ status_prompt_set(struct client *c, const char *msg, const char *input, time_t t; char *tmp; - ft = format_create(NULL, 0); + ft = format_create(NULL, FORMAT_NONE, 0); format_defaults(ft, c, NULL, NULL, NULL); t = time(NULL); @@ -726,7 +731,7 @@ status_prompt_update(struct client *c, const char *msg, const char *input) time_t t; char *tmp; - ft = format_create(NULL, 0); + ft = format_create(NULL, FORMAT_NONE, 0); format_defaults(ft, c, NULL, NULL, NULL); t = time(NULL); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index d3ee667b8e2..fe6c5b08879 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.710 2017/02/01 09:55:07 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.711 2017/02/03 11:57:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1503,8 +1503,11 @@ char *paste_make_sample(struct paste_buffer *); #define FORMAT_STATUS 0x1 #define FORMAT_FORCE 0x2 #define FORMAT_NOJOBS 0x4 +#define FORMAT_NONE 0 +#define FORMAT_PANE 0x80000000U +#define FORMAT_WINDOW 0x40000000U struct format_tree; -struct format_tree *format_create(struct cmdq_item *, int); +struct format_tree *format_create(struct cmdq_item *, int, int); void format_free(struct format_tree *); void printflike(3, 4) format_add(struct format_tree *, const char *, const char *, ...); diff --git a/usr.bin/tmux/window-choose.c b/usr.bin/tmux/window-choose.c index 2e61540e270..c4e3260db50 100644 --- a/usr.bin/tmux/window-choose.c +++ b/usr.bin/tmux/window-choose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-choose.c,v 1.85 2017/01/24 21:50:23 nicm Exp $ */ +/* $OpenBSD: window-choose.c,v 1.86 2017/02/03 11:57:28 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -202,7 +202,7 @@ window_choose_data_create(int type, struct client *c, struct session *s) wcd = xmalloc(sizeof *wcd); wcd->type = type; - wcd->ft = format_create(NULL, 0); + wcd->ft = format_create(NULL, FORMAT_NONE, 0); wcd->ft_template = NULL; wcd->command = NULL; diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 7181032d23b..ec562620650 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.164 2017/01/07 15:28:13 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.165 2017/02/03 11:57:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1611,7 +1611,7 @@ window_copy_copy_pipe(struct window_pane *wp, struct session *sess, if (buf == NULL) return; - ft = format_create(NULL, 0); + ft = format_create(NULL, FORMAT_NONE, 0); format_defaults(ft, NULL, sess, NULL, wp); expanded = format_expand(ft, arg); |