notcurses_multiselector(3)
π NAME π
okay so bestie, welcome to notcurses_multiselector(3) from the notcurses manual β¨ β this page is all about the high level widget for selecting from a set. that's it, that's the whole vibe. multiple things, you pick some, iconic. π
π¦ SYNOPSIS π¦
like, here's the whole cast of characters, copy-pasted exactly because we do NOT mess with the code, no cap:
#include <notcurses/notcurses.h>
struct ncplane;
struct notcurses;
struct ncmultiselector;
struct ncmselector_item {
const char* option;
const char* desc;
};
typedef struct ncmultiselector_options {
const char* title; // title may be NULL, inhibiting riser
const char* secondary; // secondary may be NULL
const char* footer; // footer may be NULL
struct ncmselector_item* items; // initial items, statuses
// default item (selected at start)
unsigned defidx;
// maximum number of options to display at once
unsigned maxdisplay;
// exhaustive styling options
uint64_t opchannels; // option channels
uint64_t descchannels; // description channels
uint64_t titlechannels;// title channels
uint64_t footchannels; // secondary and footer channels
uint64_t boxchannels; // border channels
uint64_t flags; // bitfield over NCMULTISELECTOR_OPTION_*
} ncmultiselector_options;
struct ncmultiselector* ncmultiselector_create(struct ncplane* n, const
ncmultiselector_options* opts);
int ncmultiselector_selected(bool* selected, unsigned n);
struct ncplane* ncmultiselector_plane(struct ncmultiselector* n);
bool ncmultiselector_offer_input(struct ncmultiselector* n, const
ncinput* nc);
void ncmultiselector_destroy(struct ncmultiselector* n);
yes bestie, ncmselector_item really is spelled like that (it's not a typo on my end, promise, that's literally what the header says π) and yes, the flags bitfield is documented as being over NCMULTISELECTOR_OPTION_* π«.
πΈ DESCRIPTION πΈ
so a multiselector widget is literally just a list of items β and when we say list, we mean it might have more items than can fit on screen at once, no biggie π«Ά. it's here to help you make a choice of zero, one, or multiple items from that list. zero! that's allowed! the bar is on the floor and honestly good for it π.
the main character energy here is that you can select and deselect items as many times as your little heart wants before the final choice gets made. toggle toggle toggle, go off queen π.
β¨ NOTES β¨
- the
ncplanen you hand toncmultiselector_createmust not beNULLβ fr fr, that's a hard requirement. and just so you know, the newncmultiselectorwill freely resize it. it's not being rude, it's just living its truth π . ncmultiselector_selectedreturns the index of the option that's currently highlighted, and it stores into the n-ary bitmap pointed to by selected based on the currently-selected options π.ncmultiselector_planewill return thencplanethat the widget is drawn on. that's the canvas, bestie πΌοΈ.- input should be run through
ncmultiselector_offer_inputso you get the common controls for free β it handles the up and down arrows, plusPageUpandPageDownβ¬οΈβ¬οΈ. and if the mouse is enabled, the mouse scrollwheel and mouse clicks on the scroll arrows will be handled too π±οΈβ¨. ncmultiselector_destroydestroys the backingncplaneβ and ngl, so doesncmultiselector_createif any error happens along the way π.- as no flags exist, the
flagsoption ought always be0. that's the whole assignment, it's giving minimalist π.
π₯ RETURN VALUES π₯
ncmultiselector_createreturnsNULLon an error, and in that case thencplaneyou passed in is destroyed π.ncmultiselector_selectedreturns-1if there are no items, or if n is not equal to the number of items. otherwise it returns the index of the currently highlighted option, and writes a bitmap to selected based off the selected items π.
π§ SEE ALSO π§
go read these next, i'm obsessed:
π AUTHORS π
nick black β nickblack@linux.com β
okay that's the whole page bestie, you ate it up, periodt π
π«Ά. this lil love letter shipped as v3.0.17 of notcurses_multiselector(3) β go forth and select multiple things, the multiselector believes in you πππ
π¦ where this page comes from
- alpine 3.24: notcurses-doc 3.0.17-r0 Β· Apache-2.0
- ubuntu resolute: libnotcurses-core-dev 3.0.17+dfsg-3 Β· Apache-2.0
- ubuntu stonking: libnotcurses-core-dev 3.0.17+dfsg-3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms