@@ -4133,15 +4133,18 @@ def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol:
4133
4133
if not cmds :
4134
4134
return
4135
4135
4136
- # Add a row that looks like a table header.
4137
- header_grid = Table .grid ()
4138
- header_grid .add_row (header , style = Cmd2Style .HELP_HEADER )
4139
- header_grid .add_row (Rule (characters = self .ruler , style = Cmd2Style .TABLE_BORDER ))
4140
- self .poutput (ru .indent (header_grid , 1 ))
4136
+ # Print a row that looks like a table header.
4137
+ if header :
4138
+ header_grid = Table .grid ()
4139
+ header_grid .add_row (header , style = Cmd2Style .HELP_HEADER )
4140
+ header_grid .add_row (Rule (characters = self .ruler , style = Cmd2Style .TABLE_BORDER ))
4141
+ self .poutput (ru .indent (header_grid , 1 ))
4142
+
4143
+ # Subtract 2 from the max column width to account for the
4144
+ # one-space indentation and a one-space right margin.
4145
+ maxcol = min (maxcol , ru .console_width ()) - 2
4141
4146
4142
4147
# Print the topics in columns.
4143
- # Subtract 1 from maxcol to account for indentation.
4144
- maxcol = min (maxcol , ru .console_width ()) - 1
4145
4148
columnized_cmds = self .render_columns (cmds , maxcol )
4146
4149
self .poutput (ru .indent (columnized_cmds , 1 ))
4147
4150
self .poutput ()
@@ -5523,7 +5526,7 @@ class TestMyAppCase(Cmd2TestCase):
5523
5526
num_transcripts = len (transcripts_expanded )
5524
5527
plural = '' if len (transcripts_expanded ) == 1 else 's'
5525
5528
self .poutput (
5526
- Rule ("cmd2 transcript test" , style = Style .null ()),
5529
+ Rule ("cmd2 transcript test" , characters = self . ruler , style = Style .null ()),
5527
5530
style = Style (bold = True ),
5528
5531
)
5529
5532
self .poutput (f'platform { sys .platform } -- Python { verinfo } , cmd2-{ cmd2 .__version__ } , readline-{ rl_type } ' )
@@ -5542,7 +5545,7 @@ class TestMyAppCase(Cmd2TestCase):
5542
5545
if test_results .wasSuccessful ():
5543
5546
self .perror (stream .read (), end = "" , style = None )
5544
5547
finish_msg = f'{ num_transcripts } transcript{ plural } passed in { execution_time :.3f} seconds'
5545
- self .psuccess (Rule (finish_msg , style = Style .null ()))
5548
+ self .psuccess (Rule (finish_msg , characters = self . ruler , style = Style .null ()))
5546
5549
else :
5547
5550
# Strip off the initial traceback which isn't particularly useful for end users
5548
5551
error_str = stream .read ()
0 commit comments