summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-06-01 00:40:48 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2020-06-01 00:41:06 -0400
commit19a142782bc1272af870cd893fd25fc7f19c9940 (patch)
tree6252421973e43545c3101bcf117f48bb44206800 /cmd2
parentcd5b98a2057c50e625eaf85cbe82f62426e49b07 (diff)
downloadcmd2-git-19a142782bc1272af870cd893fd25fc7f19c9940.tar.gz
Simplied table divider code for ease of reading
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/table_creator.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd2/table_creator.py b/cmd2/table_creator.py
index 8422fa7d..b35cade6 100644
--- a/cmd2/table_creator.py
+++ b/cmd2/table_creator.py
@@ -548,11 +548,13 @@ class SimpleTable(TableCreator):
total_width = self.total_width()
divider_char_width = ansi.style_aware_wcswidth(self.divider_char)
- # Add padding if divider char does not divide evenly into table width
- divider = (self.divider_char * (total_width // divider_char_width)) + (SPACE * (total_width % divider_char_width))
+ # Make divider as wide as table and use padding if width of
+ # divider_char does not divide evenly into table width.
+ divider = self.divider_char * (total_width // divider_char_width)
+ divider += SPACE * (total_width % divider_char_width)
+
header_buf.write('\n')
header_buf.write(divider)
-
return header_buf.getvalue()
def generate_data_row(self, row_data: Sequence[Any]) -> str: