diff --git a/archinstall/tui/curses_menu.py b/archinstall/tui/curses_menu.py index a8f0b9c13f..0dc8004483 100644 --- a/archinstall/tui/curses_menu.py +++ b/archinstall/tui/curses_menu.py @@ -849,7 +849,7 @@ def __init__( self._interrupt_warning = reset_warning_msg self._header = header - header_offset = self._get_header_offset() + header_offset = self._get_header_offset(header) self._headers = self.get_header_entries(header, offset=header_offset) if self._interrupt_warning is None: @@ -875,11 +875,19 @@ def __init__( self._init_viewports(preview_size) - def _get_header_offset(self) -> int: - # any changes here will impact the list manager table view - offset = len(self._cursor_char) + 1 - if self._multi: - offset += 3 + def _get_header_offset(self, header: str | None) -> int: + # WARNING: any changes here will impact the list manager table view + if self._orientation == Orientation.HORIZONTAL: + return 0 + + lines = header.split('\n') if header else [] + table_header = [line for line in lines if '|' in line] + longest_header = len(table_header[0]) if table_header else 0 + longest_entry = self._item_group.max_width + + delta = abs(longest_header - longest_entry) + offset = delta + 3 # 3 because it seems to align it... + return offset def run(self) -> Result: