add_option() now has a "disabled" parameter, which will add the given
option as a simple indented text. This is very similar as calling
add_text(). The advantage of having this as a parameter to add_option()
is that disabled options can now be created from the shorthand function
cli_select_item() by passing each option as a tuple or dict, which has
disabled=True set.
This is a breaking change, as the parameter order of add_option()
changes.
Menus without a header had their initial position set to the second
element by default. This was due to most menus having a header and us
calling next_item() unconditionally. Now we first go to the first
focusable item and then call next_item() as many times as needed to get
to the specified initial_pos.
If the user gave us no options then we used to just raise a ValueError
(due to initial_pos being out of range). In most - if not all - cases
it would be more favorable to act the same way as if the selection has
been aborted, so that's what we're doing now.
When a highlighter is used instead of a cursor it looks much better when
all the options have the same length. With right_pad_options all options
are right-padded with spaces so they have the same length. Also, an
example for a cursorless menu is added.
The _style is redundant, as the whole theme is a collection of styles.
Headers are not really regarded as headers, more as text. Highlight
makes more sense as highlighted.
This is an API breaking change.
When an option is passed without an item attached we now always use the
label as item. This was the behaviour for __init__() and is now also the
behaviour of add_option().
min_selection_count=n can be specify to indicate that at least n
items need to be selected before the selection is accepted.
Feature inspired by python pick.
The select/unselect icons of a CliMultiMenu will in nearly all cases be
changed together, therefore it makes sense to let the API be less
verbose for this case.
This is an API breaking change for CliMultiMenu
Originally space was thought out to also accept the selection, but only
a broken binding was added. As we want to use space for selections in
the future we now remove it entirely.
If the user only supplys a text for the option we used to return None as
item value. Now we return the text, so the user can easily get the value
back if they want to process it further and not only work with the given
option index (or supply the item twice).
get_options() and num_options used to work on all menu items, including
blank spaces and headers. Now these work only on options, as they were
originally intended
cli_select_item() allows to quickly launch a menu from code, but if only
a single item is given a selection is not necessary in most cases.
Therefore we now instantly return the given value in these cases. This
can be turned off by setting return_single=False
This uses prompt-toolkit's builtin search functionality to search
through the buffer representing the menu, allowing the user
to navigate faster through the entries