From 42ba36b5d8ab5a8442bb4996815598ef517003a2 Mon Sep 17 00:00:00 2001 From: Ninchester <5041877+ninchester@users.noreply.github.com> Date: Sat, 20 Mar 2021 22:01:00 +0100 Subject: Fix number padding based on length of the highest option index - instead of using zeroes, now spaces are used --- archinstall/lib/user_interaction.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index e7fba747..d82068a7 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -28,7 +28,8 @@ def get_password(prompt="Enter a password: "): return None def print_large_list(options, padding=5, margin_bottom=0, separator=': '): - longest_line = len(str(len(options))) + len(separator) + get_longest_option(options) + padding + highest_index_number_length = len(str(len(options))) + longest_line = highest_index_number_length + len(separator) + get_longest_option(options) + padding max_num_of_columns = get_terminal_width() // longest_line max_options_in_cells = max_num_of_columns * (get_terminal_height()-margin_bottom) @@ -39,7 +40,7 @@ def print_large_list(options, padding=5, margin_bottom=0, separator=': '): 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])) - print(f"{str(column).zfill(2)}{separator}{options[column]}", end = spaces) + print(f"{str(column): >{highest_index_number_length}}{separator}{options[column]}", end = spaces) print() def ask_for_superuser_account(prompt='Create a required super-user with sudo privileges: ', forced=False): -- cgit v1.2.3-54-g00ecf