@@ -2076,7 +2076,7 @@ def _display_matches_gnu_readline(
2076
2076
if self .formatted_completions :
2077
2077
if not hint_printed :
2078
2078
sys .stdout .write ('\n ' )
2079
- sys .stdout .write (self .formatted_completions )
2079
+ sys .stdout .write (' \n ' + self .formatted_completions + ' \n ' )
2080
2080
2081
2081
# Otherwise use readline's formatter
2082
2082
else :
@@ -2133,7 +2133,7 @@ def _display_matches_pyreadline(self, matches: list[str]) -> None: # pragma: no
2133
2133
if self .formatted_completions :
2134
2134
if not hint_printed :
2135
2135
sys .stdout .write ('\n ' )
2136
- sys .stdout .write (self .formatted_completions )
2136
+ sys .stdout .write (' \n ' + self .formatted_completions + ' \n ' )
2137
2137
2138
2138
# Redraw the prompt and input lines
2139
2139
rl_force_redisplay ()
@@ -4072,12 +4072,8 @@ def do_help(self, args: argparse.Namespace) -> None:
4072
4072
cmds_cats , cmds_doc , cmds_undoc , help_topics = self ._build_command_info ()
4073
4073
4074
4074
if self .doc_leader :
4075
- # Indent doc_leader to align with the help tables.
4076
4075
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 )
4081
4077
self .poutput ()
4082
4078
4083
4079
if not cmds_cats :
@@ -4122,9 +4118,6 @@ def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol:
4122
4118
4123
4119
Override of cmd's print_topics() to use Rich.
4124
4120
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
-
4128
4121
:param header: string to print above commands being printed
4129
4122
:param cmds: list of topics to print
4130
4123
: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:
4137
4130
if header :
4138
4131
header_grid = Table .grid ()
4139
4132
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 )
4146
4135
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 )
4150
4138
self .poutput ()
4151
4139
4152
4140
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
4160
4148
self .print_topics (header , cmds , 15 , 80 )
4161
4149
return
4162
4150
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
+
4165
4156
topics_table = Table (
4166
4157
Column ("Name" , no_wrap = True ),
4167
4158
Column ("Description" , overflow = "fold" ),
4168
- box = ru . TOP_AND_HEAD ,
4159
+ box = rich . box . SIMPLE_HEAD ,
4169
4160
border_style = Cmd2Style .TABLE_BORDER ,
4161
+ show_edge = False ,
4170
4162
)
4171
4163
4172
4164
# 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
4205
4197
# Add this command to the table
4206
4198
topics_table .add_row (command , cmd_desc )
4207
4199
4208
- self .poutput (topics_table )
4200
+ category_grid .add_row (topics_table )
4201
+ self .poutput (category_grid )
4209
4202
self .poutput ()
4210
4203
4211
4204
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:
4486
4479
Column ("Description" , overflow = "fold" ),
4487
4480
box = rich .box .SIMPLE_HEAD ,
4488
4481
border_style = Cmd2Style .TABLE_BORDER ,
4482
+ show_edge = False ,
4489
4483
)
4490
4484
4491
4485
# Build the table and populate self.last_result
@@ -4496,7 +4490,9 @@ def do_set(self, args: argparse.Namespace) -> None:
4496
4490
settable_table .add_row (param , str (settable .get_value ()), settable .description )
4497
4491
self .last_result [param ] = settable .get_value ()
4498
4492
4493
+ self .poutput ()
4499
4494
self .poutput (settable_table )
4495
+ self .poutput ()
4500
4496
4501
4497
@classmethod
4502
4498
def _build_shell_parser (cls ) -> Cmd2ArgumentParser :
0 commit comments