Repository: archlinux/archinstall

Issue:
Swedish language causes menu system to break
This happens when you click `Select disk layout (Välj hårddisk-layout)` -> `Wipe all (Töm alla)` -> `btrfs` -> `yes (Ja)` -> `yes (Ja)` 
![screenshot](https://user-images.githubusercontent.com/861439/168769523-55f759d6-98aa-4c44-b95a-c5c18e80904a.png)

99.9% of all Swedes know's English so this is not a show-stopper.


Discussion:
Hmm I just tried to reproduce this but it worked for me :O
DId you run with a special example or just `python -m archinstall` on master? 
I did run with pre-defined config:
```
$ cp examples/guided.py ./
$ sudo python guided.py --config /var/log/archinstall/user_configuration.json --creds /var/log/archinstall/user_credentials.json
```
Oddly enough, on my branch `fix-861` it breaks on English as well o0
But not before, not sure what changed.. Am I missing something in a menu secion?
![archinstall](https://user-images.githubusercontent.com/861439/168781132-634e5b65-0e82-41d6-bb9e-67cc55201306.gif)

Is it because of the way I try to initialize `Menu()`: https://github.com/archlinux/archinstall/blob/d2f3f2e5b4cad2863722db3d8b42617b3b2794dd/archinstall/lib/menu/selection_menu.py#L483-L488
Ah ok, so the issue is that something else is broken, and the `Menu` tries to quit without being fully rendered.
Meaning there is no previous height to set.

I wonder if it's because:
```
archinstall/locales/en/LC_MESSAGES/base.po~:msgid "Archinstall language"
archinstall/locales/en/LC_MESSAGES/base.po:msgid "Archinstall language"
```
Because I have a `.po~`? Nope..
I feel like I'm doing something not quite right here...

https://user-images.githubusercontent.com/19396770/168786199-ca5d897d-dd9a-4739-b242-53bfa2923225.mp4


> Because I have a .po~? Nope..

Nah that's all fine, I think they're just temporary files generated when running the script or doing translations. They should be excluded within the gitignore 
Haha love your hostname!

Ok I shit you not, I just jumped into another archinstall directory.
That worked.. Jumped back into the broken folder, now that works too o0

What the spooky hell?
![archinstall](https://user-images.githubusercontent.com/861439/168787061-4dadda7b-0886-464a-9c26-0f92ee182aa1.gif)

okay I pulled your branch and I get the error now oO 
I think this is the actual error 
```
Traceback (most recent call last):   set: English                                                                                                                                                                                                              
  File "/home/dan/Git/original-archinstall/archinstall/archinstall/lib/menu/simple_menu.py", line 1485, in show                                                                                                                                                
    self._paint_menu()               set: []                                                                                                                                                                                                                   
  File "/home/dan/Git/original-archinstall/archinstall/archinstall/lib/menu/simple_menu.py", line 1393, in _paint_menu                                                                                                                                         
    displayed_menu_height += print_preview(displayed_menu_height, preview_max_num_lines)                                                                                                                                                                       
  File "/home/dan/Git/original-archinstall/archinstall/archinstall/lib/menu/simple_menu.py", line 1224, in print_preview                                                                                                                                       
    preview_string = get_preview_string() systemd-bootctl                                                                                                                                                                                                      
  File "/home/dan/Git/original-archinstall/archinstall/archinstall/lib/menu/simple_menu.py", line 1167, in get_preview_string                                                                                                                                  
    preview_string = self._preview_command(preview_argument) if preview_argument is not None else ""                                                                                                                                                           
  File "/home/dan/Git/original-archinstall/archinstall/archinstall/lib/menu/selection_menu.py", line 267, in _preview_display                                                                                                                                  
    config_name, selector = self._find_selection(selection_name)                                                                                                                                                                                               
  File "/home/dan/Git/original-archinstall/archinstall/archinstall/lib/menu/selection_menu.py", line 280, in _find_selection                                                                                                                                   
    raise ValueError(f'Selection not found: {selection_name}')   
    ```
Yepp that's what I'm getting to.
let me dig a bit, this looks really strange, the problem seems to be that the spacing isn't quite right when it compares the selected menu entry 
Thank you for checking it out. Kind of stuck with the Yunikey implementation hehe

Resolving patch:
diff --git a/archinstall/lib/menu/selection_menu.py b/archinstall/lib/menu/selection_menu.py
--- a/archinstall/lib/menu/selection_menu.py
+++ b/archinstall/lib/menu/selection_menu.py
@@ -272,7 +272,8 @@ def _get_menu_text_padding(self, entries: List[Selector]):
 		return max([len(str(selection.description)) for selection in entries])
 
 	def _find_selection(self, selection_name: str) -> Tuple[str, Selector]:
-		padding = self._get_menu_text_padding(list(self._menu_options.values()))
+		enabled_menus = self._menus_to_enable()
+		padding = self._get_menu_text_padding(list(enabled_menus.values()))
 		option = [(k, v) for k, v in self._menu_options.items() if v.menu_text(padding).strip() == selection_name.strip()]
 
 		if len(option) != 1:


Test patch: