mirror of
https://github.com/evennia/evennia.git
synced 2026-03-17 05:16:31 +01:00
Further fixes to format_grid
This commit is contained in:
parent
c9cab183f5
commit
a863ff77db
1 changed files with 10 additions and 11 deletions
|
|
@ -1746,18 +1746,13 @@ def format_grid(elements, width=78, sep=" "):
|
|||
wl = wls[ie]
|
||||
lrow = len(row)
|
||||
debug = row.replace(" ", ".")
|
||||
# from evennia import set_trace;set_trace()
|
||||
if ie >= nelements - 1:
|
||||
# last element in list - make sure to add it
|
||||
if lrow + wl > width:
|
||||
# last slot extends outside grid, move to next line
|
||||
row += " " * (width - lrow)
|
||||
rows.append(row)
|
||||
row = crop(element, width)
|
||||
else:
|
||||
row += crop(element, width)
|
||||
row += " " * max(0, (width - len(row)))
|
||||
|
||||
if lrow + wl > width:
|
||||
# last slot extends outside grid, move to next line
|
||||
row += " " * (width - lrow)
|
||||
rows.append(row)
|
||||
row = crop(element, width)
|
||||
ic = 0
|
||||
elif ic >= aver_per_row - 1:
|
||||
# last slot on the line
|
||||
if ic == 0:
|
||||
|
|
@ -1796,6 +1791,10 @@ def format_grid(elements, width=78, sep=" "):
|
|||
row += element + " " * max(0, averlen - wl)
|
||||
ic += 1
|
||||
|
||||
if ie >= nelements - 1:
|
||||
# last element, make sure to store
|
||||
rows.append(row)
|
||||
|
||||
return "\n".join(rows)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue