From 19a142782bc1272af870cd893fd25fc7f19c9940 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Mon, 1 Jun 2020 00:40:48 -0400 Subject: Simplied table divider code for ease of reading --- cmd2/table_creator.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cmd2') 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: -- cgit v1.2.1