@@ -4133,15 +4133,18 @@ def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol:
41334133 if not cmds :
41344134 return
41354135
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
41414146
41424147 # Print the topics in columns.
4143- # Subtract 1 from maxcol to account for indentation.
4144- maxcol = min (maxcol , ru .console_width ()) - 1
41454148 columnized_cmds = self .render_columns (cmds , maxcol )
41464149 self .poutput (ru .indent (columnized_cmds , 1 ))
41474150 self .poutput ()
@@ -5523,7 +5526,7 @@ class TestMyAppCase(Cmd2TestCase):
55235526 num_transcripts = len (transcripts_expanded )
55245527 plural = '' if len (transcripts_expanded ) == 1 else 's'
55255528 self .poutput (
5526- Rule ("cmd2 transcript test" , style = Style .null ()),
5529+ Rule ("cmd2 transcript test" , characters = self . ruler , style = Style .null ()),
55275530 style = Style (bold = True ),
55285531 )
55295532 self .poutput (f'platform { sys .platform } -- Python { verinfo } , cmd2-{ cmd2 .__version__ } , readline-{ rl_type } ' )
@@ -5542,7 +5545,7 @@ class TestMyAppCase(Cmd2TestCase):
55425545 if test_results .wasSuccessful ():
55435546 self .perror (stream .read (), end = "" , style = None )
55445547 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 ()))
55465549 else :
55475550 # Strip off the initial traceback which isn't particularly useful for end users
55485551 error_str = stream .read ()
0 commit comments