6565
6666import rich .box
6767from rich .console import Group
68- from rich .padding import Padding
6968from rich .rule import Rule
7069from rich .style import Style , StyleType
7170from rich .table import (
@@ -4076,9 +4075,8 @@ def do_help(self, args: argparse.Namespace) -> None:
40764075 # Indent doc_leader to align with the help tables.
40774076 self .poutput ()
40784077 self .poutput (
4079- Padding .indent (self .doc_leader , 1 ),
4078+ ru .indent (self .doc_leader , 1 ),
40804079 style = Cmd2Style .HELP_LEADER ,
4081- soft_wrap = False ,
40824080 )
40834081 self .poutput ()
40844082
@@ -4135,17 +4133,20 @@ def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol:
41354133 if not cmds :
41364134 return
41374135
4138- # Add a row that looks like a table header.
4139- header_grid = Table .grid ()
4140- header_grid .add_row (header , style = Cmd2Style .HELP_HEADER )
4141- header_grid .add_row (Rule (characters = self .ruler , style = Cmd2Style .TABLE_BORDER ))
4142- self .poutput (Padding .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
41434146
41444147 # Print the topics in columns.
4145- # Subtract 1 from maxcol to account for indentation.
4146- maxcol = min (maxcol , ru .console_width ()) - 1
41474148 columnized_cmds = self .render_columns (cmds , maxcol )
4148- self .poutput (Padding .indent (columnized_cmds , 1 ), soft_wrap = False )
4149+ self .poutput (ru .indent (columnized_cmds , 1 ))
41494150 self .poutput ()
41504151
41514152 def _print_documented_command_topics (self , header : str , cmds : list [str ], verbose : bool ) -> None :
@@ -4160,11 +4161,7 @@ def _print_documented_command_topics(self, header: str, cmds: list[str], verbose
41604161 return
41614162
41624163 # Indent header to align with the help tables.
4163- self .poutput (
4164- Padding .indent (header , 1 ),
4165- style = Cmd2Style .HELP_HEADER ,
4166- soft_wrap = False ,
4167- )
4164+ self .poutput (ru .indent (header , 1 ), style = Cmd2Style .HELP_HEADER )
41684165 topics_table = Table (
41694166 Column ("Name" , no_wrap = True ),
41704167 Column ("Description" , overflow = "fold" ),
@@ -5529,7 +5526,7 @@ class TestMyAppCase(Cmd2TestCase):
55295526 num_transcripts = len (transcripts_expanded )
55305527 plural = '' if len (transcripts_expanded ) == 1 else 's'
55315528 self .poutput (
5532- Rule ("cmd2 transcript test" , style = Style .null ()),
5529+ Rule ("cmd2 transcript test" , characters = self . ruler , style = Style .null ()),
55335530 style = Style (bold = True ),
55345531 )
55355532 self .poutput (f'platform { sys .platform } -- Python { verinfo } , cmd2-{ cmd2 .__version__ } , readline-{ rl_type } ' )
@@ -5548,7 +5545,7 @@ class TestMyAppCase(Cmd2TestCase):
55485545 if test_results .wasSuccessful ():
55495546 self .perror (stream .read (), end = "" , style = None )
55505547 finish_msg = f'{ num_transcripts } transcript{ plural } passed in { execution_time :.3f} seconds'
5551- self .psuccess (Rule (finish_msg , style = Style .null ()))
5548+ self .psuccess (Rule (finish_msg , characters = self . ruler , style = Style .null ()))
55525549 else :
55535550 # Strip off the initial traceback which isn't particularly useful for end users
55545551 error_str = stream .read ()
0 commit comments