@@ -2076,7 +2076,7 @@ def _display_matches_gnu_readline(
20762076 if self .formatted_completions :
20772077 if not hint_printed :
20782078 sys .stdout .write ('\n ' )
2079- sys .stdout .write (self .formatted_completions )
2079+ sys .stdout .write (' \n ' + self .formatted_completions + ' \n ' )
20802080
20812081 # Otherwise use readline's formatter
20822082 else :
@@ -2133,7 +2133,7 @@ def _display_matches_pyreadline(self, matches: list[str]) -> None: # pragma: no
21332133 if self .formatted_completions :
21342134 if not hint_printed :
21352135 sys .stdout .write ('\n ' )
2136- sys .stdout .write (self .formatted_completions )
2136+ sys .stdout .write (' \n ' + self .formatted_completions + ' \n ' )
21372137
21382138 # Redraw the prompt and input lines
21392139 rl_force_redisplay ()
@@ -4072,12 +4072,8 @@ def do_help(self, args: argparse.Namespace) -> None:
40724072 cmds_cats , cmds_doc , cmds_undoc , help_topics = self ._build_command_info ()
40734073
40744074 if self .doc_leader :
4075- # Indent doc_leader to align with the help tables.
40764075 self .poutput ()
4077- self .poutput (
4078- ru .indent (self .doc_leader , 1 ),
4079- style = Cmd2Style .HELP_LEADER ,
4080- )
4076+ self .poutput (self .doc_leader , style = Cmd2Style .HELP_LEADER )
40814077 self .poutput ()
40824078
40834079 if not cmds_cats :
@@ -4122,9 +4118,6 @@ def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol:
41224118
41234119 Override of cmd's print_topics() to use Rich.
41244120
4125- The output for both the header and the commands is indented by one space to align
4126- with the tables printed by the `help -v` command.
4127-
41284121 :param header: string to print above commands being printed
41294122 :param cmds: list of topics to print
41304123 :param cmdlen: unused, even by cmd's version
@@ -4137,16 +4130,11 @@ def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol:
41374130 if header :
41384131 header_grid = Table .grid ()
41394132 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
4133+ header_grid .add_row (Rule (characters = self .ruler ))
4134+ self .poutput (header_grid )
41464135
4147- # Print the topics in columns.
4148- columnized_cmds = self .render_columns (cmds , maxcol )
4149- self .poutput (ru .indent (columnized_cmds , 1 ))
4136+ # Subtract 1 from maxcol to account for a one-space right margin.
4137+ self .columnize (cmds , maxcol - 1 )
41504138 self .poutput ()
41514139
41524140 def _print_documented_command_topics (self , header : str , cmds : list [str ], verbose : bool ) -> None :
@@ -4160,13 +4148,17 @@ def _print_documented_command_topics(self, header: str, cmds: list[str], verbose
41604148 self .print_topics (header , cmds , 15 , 80 )
41614149 return
41624150
4163- # Indent header to align with the help tables.
4164- self .poutput (ru .indent (header , 1 ), style = Cmd2Style .HELP_HEADER )
4151+ # Create a grid to hold the header and the topics table
4152+ category_grid = Table .grid ()
4153+ category_grid .add_row (header , style = Cmd2Style .HELP_HEADER )
4154+ category_grid .add_row (Rule (characters = self .ruler ))
4155+
41654156 topics_table = Table (
41664157 Column ("Name" , no_wrap = True ),
41674158 Column ("Description" , overflow = "fold" ),
4168- box = ru . TOP_AND_HEAD ,
4159+ box = rich . box . SIMPLE_HEAD ,
41694160 border_style = Cmd2Style .TABLE_BORDER ,
4161+ show_edge = False ,
41704162 )
41714163
41724164 # Try to get the documentation string for each command
@@ -4205,7 +4197,8 @@ def _print_documented_command_topics(self, header: str, cmds: list[str], verbose
42054197 # Add this command to the table
42064198 topics_table .add_row (command , cmd_desc )
42074199
4208- self .poutput (topics_table )
4200+ category_grid .add_row (topics_table )
4201+ self .poutput (category_grid )
42094202 self .poutput ()
42104203
42114204 def render_columns (self , str_list : list [str ] | None , display_width : int = 80 ) -> str :
@@ -4486,6 +4479,7 @@ def do_set(self, args: argparse.Namespace) -> None:
44864479 Column ("Description" , overflow = "fold" ),
44874480 box = rich .box .SIMPLE_HEAD ,
44884481 border_style = Cmd2Style .TABLE_BORDER ,
4482+ show_edge = False ,
44894483 )
44904484
44914485 # Build the table and populate self.last_result
@@ -4496,7 +4490,9 @@ def do_set(self, args: argparse.Namespace) -> None:
44964490 settable_table .add_row (param , str (settable .get_value ()), settable .description )
44974491 self .last_result [param ] = settable .get_value ()
44984492
4493+ self .poutput ()
44994494 self .poutput (settable_table )
4495+ self .poutput ()
45004496
45014497 @classmethod
45024498 def _build_shell_parser (cls ) -> Cmd2ArgumentParser :
0 commit comments