cqlsh: fix col. width in presence of wide unicode glyphs

Patch by paul cannon, reviewed by brandonwilliams for CASSANDRA-4033
This commit is contained in:
Brandon Williams 2012-03-27 13:51:02 -05:00
parent 46689e51b4
commit 9fc1d5c23a
1 changed files with 2 additions and 2 deletions

View File

@ -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))