Fix minor issues (#1132)

Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
This commit is contained in:
Daniel Girtler 2022-05-06 22:37:40 +10:00 committed by GitHub
parent 184373ee84
commit 050d7c9c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -160,6 +160,7 @@ class Menu(TerminalMenu):
preview_command=preview_command,
preview_size=preview_size,
preview_title=preview_title,
multi_select_select_on_accept=False,
**kwargs,
)

View File

@ -309,8 +309,15 @@ class GeneralMenu:
if selection and self.auto_cursor:
cursor_pos = menu_options.index(selection) + 1 # before the strip otherwise fails
if cursor_pos >= len(menu_options):
cursor_pos = len(menu_options) - 1
# in case the new position lands on a "placeholder" we'll skip them as well
while True:
if cursor_pos >= len(menu_options):
cursor_pos = 0
if len(menu_options[cursor_pos]) > 0:
break
cursor_pos += 1
selection = selection.strip()
if selection:
# if this calls returns false, we exit the menu. We allow for an callback for special processing on realeasing control