From 9fc1d5c23a58e06e104b94271b25fdf2eb048ed4 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 27 Mar 2012 13:51:02 -0500 Subject: [PATCH] cqlsh: fix col. width in presence of wide unicode glyphs Patch by paul cannon, reviewed by brandonwilliams for CASSANDRA-4033 --- bin/cqlsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cqlsh b/bin/cqlsh index 027b65e069..8a9d98c75a 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))