mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
2c755e3c55
@ -86,7 +86,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
||||||
format_defaults(ft, target_c, s, wl, wp);
|
format_defaults(ft, target_c, s, wl, wp);
|
||||||
|
|
||||||
msg = format_expand_time(ft, template, time(NULL));
|
msg = format_expand_time(ft, template, 0);
|
||||||
if (args_has(self->args, 'p'))
|
if (args_has(self->args, 'p'))
|
||||||
cmdq_print(item, "%s", msg);
|
cmdq_print(item, "%s", msg);
|
||||||
else if (c != NULL)
|
else if (c != NULL)
|
||||||
|
@ -109,7 +109,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
/* Expand the command. */
|
/* Expand the command. */
|
||||||
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
||||||
format_defaults(ft, c, s, wl, wp);
|
format_defaults(ft, c, s, wl, wp);
|
||||||
cmd = format_expand_time(ft, args->argv[0], time(NULL));
|
cmd = format_expand_time(ft, args->argv[0], 0);
|
||||||
format_free(ft);
|
format_free(ft);
|
||||||
|
|
||||||
/* Fork the child. */
|
/* Fork the child. */
|
||||||
|
21
format.c
21
format.c
@ -95,9 +95,10 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2)
|
|||||||
#define FORMAT_QUOTE 0x8
|
#define FORMAT_QUOTE 0x8
|
||||||
#define FORMAT_LITERAL 0x10
|
#define FORMAT_LITERAL 0x10
|
||||||
#define FORMAT_EXPAND 0x20
|
#define FORMAT_EXPAND 0x20
|
||||||
#define FORMAT_SESSIONS 0x40
|
#define FORMAT_EXPANDTIME 0x40
|
||||||
#define FORMAT_WINDOWS 0x80
|
#define FORMAT_SESSIONS 0x80
|
||||||
#define FORMAT_PANES 0x100
|
#define FORMAT_WINDOWS 0x100
|
||||||
|
#define FORMAT_PANES 0x200
|
||||||
|
|
||||||
/* Entry in format tree. */
|
/* Entry in format tree. */
|
||||||
struct format_entry {
|
struct format_entry {
|
||||||
@ -1017,7 +1018,7 @@ format_build_modifiers(struct format_tree *ft, const char **s, u_int *count)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Modifiers are a ; separated list of the forms:
|
* Modifiers are a ; separated list of the forms:
|
||||||
* l,m,C,b,d,t,q
|
* l,m,C,b,d,t,q,E,T,S,W,P
|
||||||
* =a
|
* =a
|
||||||
* =/a
|
* =/a
|
||||||
* =/a/
|
* =/a/
|
||||||
@ -1034,7 +1035,7 @@ format_build_modifiers(struct format_tree *ft, const char **s, u_int *count)
|
|||||||
cp++;
|
cp++;
|
||||||
|
|
||||||
/* Check single character modifiers with no arguments. */
|
/* Check single character modifiers with no arguments. */
|
||||||
if (strchr("lmCbdtqESWP", cp[0]) != NULL &&
|
if (strchr("lmCbdtqETSWP", cp[0]) != NULL &&
|
||||||
format_is_end(cp[1])) {
|
format_is_end(cp[1])) {
|
||||||
format_add_modifier(&list, count, cp, 1, NULL, 0);
|
format_add_modifier(&list, count, cp, 1, NULL, 0);
|
||||||
cp++;
|
cp++;
|
||||||
@ -1321,6 +1322,9 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
|
|||||||
case 'E':
|
case 'E':
|
||||||
modifiers |= FORMAT_EXPAND;
|
modifiers |= FORMAT_EXPAND;
|
||||||
break;
|
break;
|
||||||
|
case 'T':
|
||||||
|
modifiers |= FORMAT_EXPANDTIME;
|
||||||
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
modifiers |= FORMAT_SESSIONS;
|
modifiers |= FORMAT_SESSIONS;
|
||||||
break;
|
break;
|
||||||
@ -1448,6 +1452,11 @@ done:
|
|||||||
free(value);
|
free(value);
|
||||||
value = new;
|
value = new;
|
||||||
}
|
}
|
||||||
|
else if (modifiers & FORMAT_EXPANDTIME) {
|
||||||
|
new = format_expand_time(ft, value, 0);
|
||||||
|
free(value);
|
||||||
|
value = new;
|
||||||
|
}
|
||||||
|
|
||||||
/* Perform substitution if any. */
|
/* Perform substitution if any. */
|
||||||
if (sub != NULL) {
|
if (sub != NULL) {
|
||||||
@ -1498,6 +1507,8 @@ format_expand_time(struct format_tree *ft, const char *fmt, time_t t)
|
|||||||
if (fmt == NULL || *fmt == '\0')
|
if (fmt == NULL || *fmt == '\0')
|
||||||
return (xstrdup(""));
|
return (xstrdup(""));
|
||||||
|
|
||||||
|
if (t == 0)
|
||||||
|
t = time(NULL);
|
||||||
tm = localtime(&t);
|
tm = localtime(&t);
|
||||||
|
|
||||||
if (strftime(s, sizeof s, fmt, tm) == 0)
|
if (strftime(s, sizeof s, fmt, tm) == 0)
|
||||||
|
@ -1547,7 +1547,7 @@ server_client_set_title(struct client *c)
|
|||||||
ft = format_create(c, NULL, FORMAT_NONE, 0);
|
ft = format_create(c, NULL, FORMAT_NONE, 0);
|
||||||
format_defaults(ft, c, NULL, NULL, NULL);
|
format_defaults(ft, c, NULL, NULL, NULL);
|
||||||
|
|
||||||
title = format_expand_time(ft, template, time(NULL));
|
title = format_expand_time(ft, template, 0);
|
||||||
if (c->title == NULL || strcmp(title, c->title) != 0) {
|
if (c->title == NULL || strcmp(title, c->title) != 0) {
|
||||||
free(c->title);
|
free(c->title);
|
||||||
c->title = xstrdup(title);
|
c->title = xstrdup(title);
|
||||||
|
6
tmux.1
6
tmux.1
@ -3821,6 +3821,12 @@ will expand the format twice, for example
|
|||||||
is the result of expanding the content of the
|
is the result of expanding the content of the
|
||||||
.Ic status-left
|
.Ic status-left
|
||||||
option rather than the content itself.
|
option rather than the content itself.
|
||||||
|
.Ql T:
|
||||||
|
is like
|
||||||
|
.Ql E:
|
||||||
|
but also expands
|
||||||
|
.Xr strftime 3
|
||||||
|
specifiers.
|
||||||
.Ql S: ,
|
.Ql S: ,
|
||||||
.Ql W:
|
.Ql W:
|
||||||
or
|
or
|
||||||
|
Loading…
Reference in New Issue
Block a user