summaryrefslogtreecommitdiffstats
path: root/format.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-21 16:14:09 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-21 16:14:09 +0000
commit63b4fd5cacc1a53b93e92ef007d5a7249f5cac38 (patch)
treeefe04a456d3a8cda3f84611174e33caf0f74a9cf /format.c
parentdd76497ab01620bf5c7b63205f3e1405f3c34d8c (diff)
Add a format client_prefix which is 1 if prefix key has been
pressed, used for example #{?client_prefix,X,Y}. Also a few extra server_client_status needed.
Diffstat (limited to 'format.c')
-rw-r--r--format.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/format.c b/format.c
index e950df53..f005c1c4 100644
--- a/format.c
+++ b/format.c
@@ -251,10 +251,11 @@ format_expand(struct format_tree *ft, const char *fmt)
continue;
}
}
- while (len - off < 2) {
+ while (len - off < 3) {
buf = xrealloc(buf, 2, len);
len *= 2;
}
+ buf[off++] = '#';
buf[off++] = ch;
continue;
}
@@ -321,6 +322,8 @@ format_client(struct format_tree *ft, struct client *c)
*strchr(tim, '\n') = '\0';
format_add(ft, "client_activity_string", "%s", tim);
+ format_add(ft, "client_prefix", "%d", !!(c->flags & CLIENT_PREFIX));
+
if (c->tty.flags & TTY_UTF8)
format_add(ft, "client_utf8", "%d", 1);
else