Skip to content

Commit 19a1427

Browse files
committed
Simplied table divider code for ease of reading
1 parent cd5b98a commit 19a1427

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmd2/table_creator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,13 @@ def generate_header(self) -> str:
548548
total_width = self.total_width()
549549
divider_char_width = ansi.style_aware_wcswidth(self.divider_char)
550550

551-
# Add padding if divider char does not divide evenly into table width
552-
divider = (self.divider_char * (total_width // divider_char_width)) + (SPACE * (total_width % divider_char_width))
551+
# Make divider as wide as table and use padding if width of
552+
# divider_char does not divide evenly into table width.
553+
divider = self.divider_char * (total_width // divider_char_width)
554+
divider += SPACE * (total_width % divider_char_width)
555+
553556
header_buf.write('\n')
554557
header_buf.write(divider)
555-
556558
return header_buf.getvalue()
557559

558560
def generate_data_row(self, row_data: Sequence[Any]) -> str:

0 commit comments

Comments
 (0)