X Tutup
Skip to content

Commit e7d6974

Browse files
display keys from top do bottom in key display
1 parent bace621 commit e7d6974

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bpython/curtsiesfrontend/replpainter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ def add_border(line):
175175
def paint_last_events(rows, columns, names, config):
176176
if not names:
177177
return fsarray([])
178-
width = min(max(len(name) for name in names), columns-2)
178+
width = min(max([len(name) for name in names] + [0]), columns-2)
179179
output_lines = []
180180
output_lines.append(config.left_top_corner+config.top_border*(width)+config.right_top_corner)
181-
for name in names[max(0, len(names)-(rows-2)):]:
181+
for name in reversed(names[max(0, len(names)-(rows-2)):]):
182182
output_lines.append(config.left_border+name[:width].center(width)+config.right_border)
183183
output_lines.append(config.left_bottom_corner+config.bottom_border*width+config.right_bottom_corner)
184184
return fsarray(output_lines)

bpython/test/test_curtsies_painting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def test_formatted_docstring(self):
101101
def test_paint_lasts_events(self):
102102
actual = replpainter.paint_last_events(4, 100, ['a', 'b', 'c'], config=setup_config())
103103
expected = fsarray(["┌─┐",
104-
"│b│",
105104
"│c│",
105+
"│b│",
106106
"└─┘"])
107107
self.assertFSArraysEqualIgnoringFormatting(actual, expected)
108108

0 commit comments

Comments
 (0)
X Tutup