Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction.py
diff options
context:
space:
mode:
authoraboven <arieboven@protonmail.com>2021-05-08 13:18:03 +0200
committeraboven <arieboven@protonmail.com>2021-05-08 13:18:03 +0200
commit24a14d1800e990e2e90dd628b8460f85fe3d1495 (patch)
tree1d376e16c33f77937b7dd473a9bc7a2f9883771c /archinstall/lib/user_interaction.py
parent52ac03d9525d0e62fef113eec057a1e846637506 (diff)
fix error when to many options and calculation spaces
Diffstat (limited to 'archinstall/lib/user_interaction.py')
-rw-r--r--archinstall/lib/user_interaction.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index be01594e..1240e0be 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -83,16 +83,18 @@ def get_password(prompt="Enter a password: "):
def print_large_list(options, padding=5, margin_bottom=0, separator=': '):
highest_index_number_length = len(str(len(options)))
longest_line = highest_index_number_length + len(separator) + get_longest_option(options) + padding
+ spaces_without_option = longest_line - (len(separator) + highest_index_number_length)
max_num_of_columns = get_terminal_width() // longest_line
max_options_in_cells = max_num_of_columns * (get_terminal_height()-margin_bottom)
if (len(options) > max_options_in_cells):
for index, option in enumerate(options):
print(f"{index}: {option}")
+ return 1, index
else:
for row in range(0, (get_terminal_height()-margin_bottom)):
for column in range(row, len(options), (get_terminal_height()-margin_bottom)):
- spaces = " "*(longest_line - len(options[column]))
+ spaces = " "*(spaces_without_option - len(options[column]))
print(f"{str(column): >{highest_index_number_length}}{separator}{options[column]}", end = spaces)
print()