Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C4DE59239 for ; Tue, 27 Mar 2012 18:51:31 +0000 (UTC) Received: (qmail 76559 invoked by uid 500); 27 Mar 2012 18:51:31 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 76511 invoked by uid 500); 27 Mar 2012 18:51:31 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 76503 invoked by uid 99); 27 Mar 2012 18:51:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Mar 2012 18:51:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 33D91965B; Tue, 27 Mar 2012 18:51:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brandonwilliams@apache.org To: commits@cassandra.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: cqlsh: fix col. width in presence of wide unicode glyphs Patch by paul cannon, reviewed by brandonwilliams for CASSANDRA-4033 Message-Id: <20120327185131.33D91965B@tyr.zones.apache.org> Date: Tue, 27 Mar 2012 18:51:31 +0000 (UTC) Updated Branches: refs/heads/cassandra-1.0 46689e51b -> 9fc1d5c23 cqlsh: fix col. width in presence of wide unicode glyphs Patch by paul cannon, reviewed by brandonwilliams for CASSANDRA-4033 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9fc1d5c2 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9fc1d5c2 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9fc1d5c2 Branch: refs/heads/cassandra-1.0 Commit: 9fc1d5c23a58e06e104b94271b25fdf2eb048ed4 Parents: 46689e5 Author: Brandon Williams Authored: Tue Mar 27 13:51:02 2012 -0500 Committer: Brandon Williams Committed: Tue Mar 27 13:51:02 2012 -0500 ---------------------------------------------------------------------- bin/cqlsh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/9fc1d5c2/bin/cqlsh ---------------------------------------------------------------------- diff --git a/bin/cqlsh b/bin/cqlsh index 027b65e..8a9d98c 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -742,10 +742,10 @@ class Shell(cmd.Cmd): formatted_data = [map(self.myformat_value, row, coltypes) for row in cursor] # determine column widths - widths = map(len, formatted_names) + widths = [n.displaywidth for n in formatted_names] for fmtrow in formatted_data: for num, col in enumerate(fmtrow): - widths[num] = max(widths[num], len(col)) + widths[num] = max(widths[num], col.displaywidth) # print header header = ' | '.join(hdr.color_ljust(w) for (hdr, w) in zip(formatted_names, widths))