field_opts(3FORM)
π field_opts β bestie, let's talk field options π
okay so this is field_opts(3FORM) from the Library calls section of the manual, and it's literally all about setting and getting the options on a FIELD in ncurses forms. it's giving "tiny API, big power", and honestly? we're obsessed. π
β¨ NAME β¨
set_field_opts, field_opts_on, field_opts_off, field_opts β set and get field options π«Ά
β¨ SYNOPSIS β¨
#include <form.h>
int set_field_opts(FIELD *field, Field_Options opts);
Field_Options field_opts(const FIELD *field);
int field_opts_on(FIELD *field, Field_Options opts);
int field_opts_off(FIELD *field, Field_Options opts);
β¨ DESCRIPTION β¨
okay so here's the vibe. four functions, one job: wrangling your field's option bits. π¦
set_field_optsβ sets all the given field's option bits. and bestie, field option bits can be logically "or"-ed together, so you can stack them up like charms on a bracelet. β¨field_opts_onβ turns on the given option bits, and leaves all the others alone. no touching, no drama.field_opts_offβ turns off the given option bits, and leaves all the others alone. same energy, opposite direction. πfield_optsβ returns the field's current option bits. it's the "what's the vibe rn" function. returns aField_Options.
πΈ standard options (all on by default) πΈ
these are the OGs, and yes, all of them are on by default. main character defaults fr fr.
O_ACTIVEβ the field is visited during processing. if this option is off, the field will not be reachable by navigation keys. β οΈ and just so you know: an invisible field appears to be inactive also. iykyk.O_AUTOSKIPβ skip to the next field when this one fills. auto-advance, no cap. βO_BLANKβ the field is cleared whenever a character is entered at the first position. clean slate behavior. π§O_EDITβ the field can be edited. that's it, that's the whole thing.O_NULLOKβ allow a blank field. empty is a valid vibe. πO_PASSOKβ validate field only if modified by user.O_PUBLICβ the field contents are displayed as data is entered. live updates, we love to see it.O_STATICβ field buffers are fixed to the field's original size. turn this option off to create a dynamic field. glow-up unlocked. β¨O_VISIBLEβ the field is displayed. if this option is off, display of the field is suppressed. ghost mode, basically. π» (well, not literally, but you get it)O_WRAPβ words that do not fit on a line are wrapped to the next line. and heads up: words are blank-separated. π
π extension options (off by default) π
these are the extra-special bonus features, and ngl, extensions are off by default. you gotta opt in.
O_DYNAMIC_JUSTIFYβ permit dynamic fields to be justified, like static fields. letting the dynamic girlies have what the static girlies have. πO_NO_LEFT_STRIPβ preserve leading whitespace in the field buffer, which is normally discarded. keeping the space, literally.O_EDGE_INSERT_STAYβ when inserting into a field up to the boundary position, optionally delay the scrolling, so that the last inserted character remains visible, but advance the cursor to reflect the insertion. and the reason this slays? it allows the form library to display the inserted character in one-character fields as well as allowing the library to maintain consistent state. π₯O_INPUT_FIELDβ theset_max_fieldfunction checks for this extension, which allows a dynamic field to shrink if the new limit is smaller than the current field size. shrinking is allowed, periodt.
β¨ RETURN VALUE β¨
so except for field_opts, each routine returns one of the following:
E_OKβ the routine succeeded. π slay.E_BAD_ARGUMENTβ routine detected an incorrect or out-of-range argument. πE_CURRENTβ the field is the current field.E_SYSTEM_ERRORβ system error occurred (seeerrno(3)). π
β¨ PORTABILITY β¨
these routines emulate the System V forms library. they were not supported on Version 7 or BSD versions. so like, if you're time-traveling, know that. π°οΈ
β¨ AUTHORS β¨
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond. absolute icons, we thank them for their service. π
β¨ SEE ALSO β¨
ncurses(3NCURSES), form(3FORM), field_just(3FORM) π
and that's the whole page bestie!! this was field_opts(3FORM) from ncurses 6.6, dated 2025-01-18. go forth and set your option bits, you've got this πβ¨π
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2014,2015 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms