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/trunk Commit: 9fc1d5c23a58e06e104b94271b25fdf2eb048ed4 Parents: 46689e5 Author: Brandon Williams <[email protected]> Authored: Tue Mar 27 13:51:02 2012 -0500 Committer: Brandon Williams <[email protected]> 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))
