Fix inline header indentation

This commit is contained in:
Sebastian Lohff 2019-02-01 18:17:35 +01:00
parent b18372e3b8
commit e0177d0e10
1 changed files with 3 additions and 3 deletions

View File

@ -97,9 +97,9 @@ class CliMenu:
for option in options: for option in options:
self.add_option(option) self.add_option(option)
def add_header(self, title, indent=False): def add_header(self, title, indent=True):
for text in title.split('\n'): for text in title.split('\n'):
self._items.append(CliMenuHeader(text)) self._items.append(CliMenuHeader(text, indent=indent))
def add_option(self, text, item=None): def add_option(self, text, item=None):
self._items.append(CliMenuOption(text, self._item_num, item=item)) self._items.append(CliMenuOption(text, self._item_num, item=item))
@ -146,7 +146,7 @@ class CliMenu:
style = s.option_style style = s.option_style
else: else:
if item.indent: if item.indent:
indent += ' ' * self._header_indent indent += ' ' * (self._header_indent + len(self._cursor) + 1)
style = s.header_style style = s.header_style
return Transformation([('', indent), (style, prefix + text)]) return Transformation([('', indent), (style, prefix + text)])