summaryrefslogtreecommitdiffstats
path: root/cmd-list-clients.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-05-19 16:08:35 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-05-19 16:08:35 +0000
commit6db7bd6791244fb0ba4bbd58526acae93cf77899 (patch)
tree82a972cb1b46f3878c7ef53ce39d5fd0b8484901 /cmd-list-clients.c
parent5db59a0d20d45d7dd961acdd0fc56714041cab55 (diff)
Try to guess if the window is UTF-8 by outputting a three-byte UTF-8 wide character and seeing how much the cursor moves. Currently tries to figure out if this works by some stupid checks on the terminal, these need to be rethought. Also might be better using a width 1 character rather than width 2.
Diffstat (limited to 'cmd-list-clients.c')
-rw-r--r--cmd-list-clients.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd-list-clients.c b/cmd-list-clients.c
index 67a0cc5b..a38f90a6 100644
--- a/cmd-list-clients.c
+++ b/cmd-list-clients.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-clients.c,v 1.13 2009-02-11 17:50:32 nicm Exp $ */
+/* $Id: cmd-list-clients.c,v 1.14 2009-05-19 16:08:35 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -47,14 +47,20 @@ cmd_list_clients_exec(unused struct cmd *self, struct cmd_ctx *ctx)
{
struct client *c;
u_int i;
+ const char *s_utf8;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session == NULL)
continue;
- ctx->print(ctx, "%s: %s [%ux%u %s]", c->tty.path,
- c->session->name, c->tty.sx, c->tty.sy, c->tty.termname);
+ if (c->tty.flags & TTY_UTF8)
+ s_utf8 = " (utf8)";
+ else
+ s_utf8 = "";
+ ctx->print(ctx, "%s: %s [%ux%u %s]%s", c->tty.path,
+ c->session->name, c->tty.sx, c->tty.sy,
+ c->tty.termname, s_utf8);
}
return (0);