Skip to content

Conversation

@Eben60
Copy link

@Eben60 Eben60 commented Nov 6, 2025

This PR addresses the issue of being unable to distinguish between a user aborting a MultiSelectMenu, and selecting no items. It also adds the ability to customize the menu header. See discussion in #44012, also #43963 and #44002.

Key Changes:

Configurable return value on cancel

RadioMenu and MultiSelectMenu now have an on_cancel keyword argument. This allows you to specify the value that request returns when the menu is aborted (e.g., by pressing 'q' or Ctrl-C). If on_cancel keyword is not specified, the default values are -1 for RadioMenu and an empty Set{Int} for MultiSelectMenu, thus ensuring backward compatibility. The recommended return value is nothing.

Customizable Menu Header

The header keyword argument has been added to RadioMenu and MultiSelectMenu. You can now provide a custom string, or use a boolean to enable/disable the default header. For RadioMenu, the default is no header (backward compatible).

Fields added

Each struct: RadioMenu and MultiSelectMenu has been extended by fields on_cancel and header. For backward compatibility, additional constructors has been added for each type, which take "the legacy number" of positional arguments and set the new fields to default values.

This PR also includes:

Updated documentation for the new features.
Additional tests for new functionalities.

@Eben60 Eben60 force-pushed the TerminalMenus_MultiSelectCancel branch from db05eaf to 3d1aac9 Compare November 7, 2025 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants