From 6db7bd6791244fb0ba4bbd58526acae93cf77899 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 19 May 2009 16:08:35 +0000 Subject: 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. --- cmd-list-clients.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cmd-list-clients.c') 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 @@ -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); -- cgit