diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-11 16:09:58 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-11 16:09:58 +0000 |
commit | a5936f0f8c862939f7dde572e6e3321e80ed2895 (patch) | |
tree | 6bf15cdef33b66035f4d23e2c955f3098974d940 /usr.bin/tmux/format.c | |
parent | 27f24acc698a0b313bd5b506cf71fc541163e526 (diff) |
Add a format for terminal type.
Diffstat (limited to 'usr.bin/tmux/format.c')
-rw-r--r-- | usr.bin/tmux/format.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index a8b39ae3713..1f025c87666 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.114 2017/01/09 21:03:25 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.115 2017/01/11 16:09:57 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1119,20 +1119,25 @@ format_defaults_client(struct format_tree *ft, struct client *c) { struct session *s; const char *name; + struct tty *tty = &c->tty; + const char *types[] = TTY_TYPES; if (ft->s == NULL) ft->s = c->session; format_add(ft, "client_pid", "%ld", (long) c->pid); - format_add(ft, "client_height", "%u", c->tty.sy); - format_add(ft, "client_width", "%u", c->tty.sx); - if (c->tty.path != NULL) - format_add(ft, "client_tty", "%s", c->tty.path); - if (c->tty.termname != NULL) - format_add(ft, "client_termname", "%s", c->tty.termname); + format_add(ft, "client_height", "%u", tty->sy); + format_add(ft, "client_width", "%u", tty->sx); + if (tty->path != NULL) + format_add(ft, "client_tty", "%s", tty->path); format_add(ft, "client_control_mode", "%d", !!(c->flags & CLIENT_CONTROL)); + if (tty->term_name != NULL) + format_add(ft, "client_termname", "%s", tty->term_name); + if (tty->term_name != NULL) + format_add(ft, "client_termtype", "%s", types[tty->term_type]); + format_add_tv(ft, "client_created", &c->creation_time); format_add_tv(ft, "client_activity", &c->activity_time); @@ -1143,7 +1148,7 @@ format_defaults_client(struct format_tree *ft, struct client *c) format_add(ft, "client_prefix", "%d", 1); format_add(ft, "client_key_table", "%s", c->keytable->name); - if (c->tty.flags & TTY_UTF8) + if (tty->flags & TTY_UTF8) format_add(ft, "client_utf8", "%d", 1); else format_add(ft, "client_utf8", "%d", 0); |