gh-125225: Fix column misalignment in help('topics') output (gh-125226)

The 'help("topics")' output was misaligned due to "ASSIGNMENTEXPRESSIONS"
exceeding the implicit maximum default column width of 19 characters.

Reduced the number of columns from 4 to 3 in the listtopics()
function to allow more space for longer topic names.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Étienne Pelletier 2025-05-19 10:10:17 -04:00 committed by GitHub
parent ee36db5500
commit b22460c44d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2110,7 +2110,7 @@ has the same effect as typing a particular string at the help> prompt.
self.output.write(_introdoc())
def list(self, items, columns=4, width=80):
items = list(sorted(items))
items = sorted(items)
colw = width // columns
rows = (len(items) + columns - 1) // columns
for row in range(rows):
@ -2142,7 +2142,7 @@ to. Enter any symbol to get more help.
Here is a list of available topics. Enter any topic name to get more help.
''')
self.list(self.topics.keys())
self.list(self.topics.keys(), columns=3)
def showtopic(self, topic, more_xrefs=''):
try: