mirror of
https://github.com/tmux/tmux.git
synced 2025-03-25 07:18:48 +00:00
Add T format modifier like E but also do strftime(3).
This commit is contained in:
parent
1416ceb575
commit
38064e7593
19
format.c
19
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 {
|
||||||
@ -1001,7 +1002,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/
|
||||||
@ -1018,7 +1019,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++;
|
||||||
@ -1305,6 +1306,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;
|
||||||
@ -1432,6 +1436,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) {
|
||||||
|
6
tmux.1
6
tmux.1
@ -3719,6 +3719,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