Curses(3)
๐ Curses(3) โ terminal screen handling and optimization ๐
User Contributed Perl Documentation ยท okay bestie, this is the Curses Perl interface, and we're getting into it.
โจ NAME โจ
Curses โ terminal screen handling and optimization
๐ธ SYNOPSIS ๐ธ
use Curses;
initscr;
...
endwin;
๐ฆ DESCRIPTION ๐ฆ
Okay so Curses is literally the interface between Perl and your system's curses(3) library. For descriptions on how to use a given function, variable, or constant, consult your system's documentation, because that info invariably varies (:-) between different curses(3) libraries and operating systems. This document describes the interface itself, and assumes you already know how your system's curses(3) library works.
๐ Unified Functions
Many curses(3) functions have variants starting with the prefixes w-, mv-, and/or wmv-. These variants differ only by explicitly adding a window, or by adding two coordinates that are used to move the cursor first. For example, addch() has three other variants: waddch(), mvaddch(), and mvwaddch(). The variants aren't very interesting; in fact, we could roll all of the variants into the original function by allowing a variable number of arguments and analyzing the argument list for which variant the user wanted to call.
Unfortunately, curses(3) predates varargs(3), so in C we were stuck with all the variants. However, Curses is a Perl interface, so we are free to "unify" these variants into one function. The section "Available Functions" below lists all curses(3) functions Curses makes available as Perl equivalents, along with a column listing if it is unified. If so, it takes a varying number of arguments as follows:
"function( [win], [y, x], args );"
win is an optional window argument, defaulting to "stdscr" if not specified.
y, x is an optional coordinate pair used to move the cursor,
defaulting to no move if not specified.
args are the required arguments of the function. These are the
arguments you would specify if you were just calling the base
function and not any of the variants.
This makes the variants obsolete, since their functionality has been merged into a single function, so Curses does not define them by default. You can still get them if you want, by setting the variable $Curses::OldCurses to a non-zero value before using the Curses package. See "Perl 4.X "cursperl" Compatibility" for an example of this.
๐ซถ Wide-Character-Aware Functions
The following are the preferred functions for working with strings, though they don't follow the normal unified function naming convention (based on the names in the Curses library) described above. Despite the naming, each corresponds to a Curses library function. For example, a getchar call performs a Curses library function in the getch family.
In addition to these functions, the Curses module contains corresponding functions with the conventional naming (e.g. getch); the duplication is for historical reasons. The preferred functions were new in Curses 1.29 (April 2014). They use the wide character functions in the Curses library if available (falling back to using the traditional non-wide-character versions). They also have a more Perl-like interface, taking care of some gory details under the hood about which a Perl programmer shouldn't have to worry.
The reason for two sets of string-handling functions is historical. The original Curses Perl module predates Curses libraries that understand multiple byte character encodings. Moreover, the module was designed to have a Perl interface that closely resembles the C interface syntactically and directly passes the internal byte representation of Perl strings to C code. This was probably fine before Perl got Unicode function, but today, Perl stores strings internally in either Latin-1 or Unicode UTF-8 and the original module was not sensitive to which encoding was used.
While most of the problems could be worked around in Perl code using the traditional interface, it's hard to get right and you need a wide-character-aware curses library (e.g. ncursesw) anyway to make it work properly. Because existing consumers of the Curses module may be relying on the traditional behavior, Curses module designers couldn't simply modify the existing functions to understand wide characters and convert from and to Perl strings.
None of these functions exist if Perl is older than 5.6.
๐ getchar
This calls wget_wch(). It returns a character -- more precisely, a one-character (not necessarily one-byte!) string holding the character -- for a normal key and a two-element list (undef, key-number) for a function key. It returns undef on error.
If you don't expect function keys (i.e. with keypad(0)), you can simply do
my $ch = getchar;
die "getchar failed" unless defined $ch;
If you do expect function keys (i.e. with keypad(1)), you can still assign the result to a scalar variable as above. Because of of the way the comma operator works, that variable will receive either undef or the string or the number, and you can decode it yourself.
my $ch = getchar;
die "getchar failed" unless defined $ch;
if (<$ch looks like a number >= 0x100>) {
<handle function key>
} else {
<handle normal key>
}
or do
my ($ch, $key) = getchar;
if (defined $key) {
<handle function key $key>
} else if (defined $ch) {
<handle normal key $ch>
} else {
die "getchar failed";
}
If wget_wch() is not available (i.e. The Curses library does not understand wide characters), this calls wgetch(), but returns the values described above nonetheless. This can be a problem because with a multibyte character encoding like UTF-8, you will receive two one-character strings for a two-byte-character (e.g. รฏยฟยฝรฏยฟยฝรฏยฟยฝรฏยฟยฝ and รขยฝ for รขยฝ). If you append these characters to a Perl string, that string may internally contain a valid UTF-8 encoding of a character, but Perl will not interpret it that way. Perl may even try to convert what it believes to be two characters to UTF-8, giving you four bytes.
๐ฆ getstring
This calls wgetn_wstr and returns a string or undef. It cannot return a function key value; the Curses library will itself interpret KEY_LEFT and KEY_BACKSPACE.
If wgett_wstr() is unavailable, this calls wgetstr().
In both cases, the function allocates a buffer of fixed size to hold the result of the Curses library call.
my $s = getstring();
die "getstring failed" unless defined $s;
๐ addstring / insstring
This adds/inserts the Perl string passed as an argument to the Curses window using waddnwstr()/wins_nwstr() or, if unavailable, waddnstr()/winsnstr(). It returns a true value on success, false on failure.
addstring("Hรขยฝllรขยก, Wรขยกrld") || die "addstring failed";
๐ instring
This returns a Perl string (or undef on failure) holding the characters from the current cursor position up to the end of the line. It uses winnwstr() if available, and otherwise innstr().
my $s = instring();
die "instring failed" unless defined $s;
๐ ungetchar
This pushes one character (passed as a one-character Perl string) back to the input queue. It uses unget_wch() or ungetch(). It returns a true value on success, false on failure. It cannot push back a function key; the Curses library provides no way to push back function keys, only characters.
ungetchar("X") or die "ungetchar failed";
The Curses module provides no interface to the complex-character routines (wadd_wch(), wadd_wchnstr(), wecho_wchar(), win_wch(), win_wchnstr(), wins_wch()) because there is no sensible way of converting from Perl to a C cchar_t or back.
๐ Objects
Objects work. Example:
$win = new Curses;
$win->addstr(10, 10, 'foo');
$win->refresh;
...
Any function that has been marked as unified (see "Available Functions" below and "Unified Functions" above) can be called as a method for a Curses object.
Do not use initscr() if using objects, as the first call to get a new Curses will do it for you.
๐จ Security Concerns
It has always been the case with the curses functions, but please note that the following functions:
getstr() (and optional wgetstr(), mvgetstr(), and mvwgetstr())
inchstr() (and optional winchstr(), mvinchstr(), and mvwinchstr())
instr() (and optional winstr(), mvinstr(), and mvwinstr())
are subject to buffer overflow attack. This is because you pass in the buffer to be filled in, which has to be of finite length, but there is no way to stop a bad guy from typing.
In order to avoid this problem, use the alternate functions:
getnstr()
inchnstr()
innstr()
which take an extra "size of buffer" argument or the wide-character-aware getstring() and instring() versions.
๐ COMPATIBILITY ๐
๐ Perl 4.X "cursperl" Compatibility
Curses was written to take advantage of features of Perl 5 and later. The author thought it was better to provide an improved curses programming environment than to be 100% compatible. However, many old "curseperl" applications will probably still work by starting the script with:
BEGIN { $Curses::OldCurses = 1; }
use Curses;
Any old application that still does not work should print an understandable error message explaining the problem.
Some functions and variables are not available through Curses, even with the BEGIN line. They are listed under "Curses items not available through Perl Curses".
The variables $stdscr and $curscr are also available as functions stdscr and curscr. This is because of a Perl bug. See the LIMITATIONS section for details.
๐ง Incompatibilities with previous versions of Curses
In previous versions of this software, some Perl functions took a different set of parameters than their C counterparts. This is not true in the current version. You should now use getstr($str) and getyx($y, $x) instead of $str = getstr() and ($y, $x) = getyx().
๐ DIAGNOSTICS ๐
okay so when stuff goes wrong, here's what Curses is gonna yell at you, bestie โ and what it actually means ๐
Curses function '%s' called with too %s arguments at ...โ you called aCursesfunction with the wrong number of arguments fr. Count your args, babe ๐งฎargument %d to Curses function '%s' is not a Curses %s at ...argument is not a Curses %s at ...โ the argument you handed over wasn't a valid type for the spot you put it in, no cap. lowkey this usually means you didn't give the right arguments to a unified function โ go peek at the DESCRIPTION section on "Unified Functions" for the tea โCurses function '%s' is not defined in your Curses library at ...โ your code calls a PerlCursesfunction that your system's Curses library just doesn't provide ๐ not your fault, the library's built differentCurses variable '%s' is not defined in your Curses library at ...โ same vibe but for a variable: your code wants a PerlCursesvariable your system's Curses library doesn't haveCurses constant '%s' is not defined in your Curses library at ...โ you're referencing the specifiedCursesconstant, and your system's Curses library doesn't provide it ๐Curses::Vars::FETCH called with bad index at ...Curses::Vars::STORE called with bad index at ...โ ooh you've been messing with thetieinterface to theCursesvariables ๐ don't do that.:-)(iconic of the docs to include a smiley ngl)- Anything else โ check out the perldiag man page to see if the error's chilling in there ๐
๐ง LIMITATIONS ๐ง
So here's the one gotcha, bestie โ if you use the variables $stdscr and $curscr instead of their functional counterparts (stdscr and curscr), you might hit a bug in Perl where the "magic" isn't called early enough ๐ญ
What that looks like in practice? The Curses package straight-up tells you $stdscr isn't a window. Rude. ๐
One workaround is to put a line like this near the front of your program:
$stdscr = $stdscr
weird-looking? yes. does it work? apparently. slay ๐ซถ
๐ AUTHOR ๐
William Setzer <William_Setzer@ncsu.edu>
Available Functions
okay bestie, this is the big one โ the full roster of what's available, and there is a lot of it. Drink some water first ๐ง Two columns you gotta keep straight:
- Unified? โ the column literally says
YesorNo, and I'm handing it to you exactly as it's written. No editorialising, no vibes-based guessing. - Available via
$OldCurses[*]โ the old-school spellings you can still reach through$OldCurses[*], likewaddchandmvaddch. If that column's empty, then nothing's listed there, periodt.
Here we go ๐
addchโ unified โ โ via$OldCurses[*]:waddch,mvaddch,mvwaddchechocharโ unified โ โ via$OldCurses[*]:wechocharaddchstrโ unified โ โ via$OldCurses[*]:waddchstr,mvaddchstr,mvwaddchstraddchnstrโ unified โ โ via$OldCurses[*]:waddchnstr,mvaddchnstr,mvwaddchnstraddstrโ unified โ โ via$OldCurses[*]:waddstr,mvaddstr,mvwaddstraddnstrโ unified โ โ via$OldCurses[*]:waddnstr,mvaddnstr,mvwaddnstrattroffโ unified โ โ via$OldCurses[*]:wattroffattronโ unified โ โ via$OldCurses[*]:wattronattrsetโ unified โ โ via$OldCurses[*]:wattrsetstandendโ unified โ โ via$OldCurses[*]:wstandendstandoutโ unified โ โ via$OldCurses[*]:wstandoutattr_getโ unified โ โ via$OldCurses[*]:wattr_getattr_offโ unified โ โ via$OldCurses[*]:wattr_offattr_onโ unified โ โ via$OldCurses[*]:wattr_onattr_setโ unified โ โ via$OldCurses[*]:wattr_setchgatโ unified โ โ via$OldCurses[*]:wchgat,mvchgat,mvwchgatCOLOR_PAIRโ not unifiedPAIR_NUMBERโ not unifiedbeepโ not unifiedflashโ not unifiedbkgdโ unified โ โ via$OldCurses[*]:wbkgdbkgdsetโ unified โ โ via$OldCurses[*]:wbkgdsetgetbkgdโ unified โ (no extra spellings listed)borderโ unified โ โ via$OldCurses[*]:wborderboxโ unified โ (no extra spellings listed)hlineโ unified โ โ via$OldCurses[*]:whline,mvhline,mvwhlinevlineโ unified โ โ via$OldCurses[*]:wvline,mvvline,mvwvlineeraseโ unified โ โ via$OldCurses[*]:weraseclearโ unified โ โ via$OldCurses[*]:wclearclrtobotโ unified โ โ via$OldCurses[*]:wclrtobotclrtoeolโ unified โ โ via$OldCurses[*]:wclrtoeolstart_colorโ not unifiedinit_pairโ not unifiedinit_colorโ not unifiedhas_colorsโ not unifiedcan_change_colorโ not unifiedcolor_contentโ not unifiedpair_contentโ not unifieddelchโ unified โ โ via$OldCurses[*]:wdelch,mvdelch,mvwdelchdeletelnโ unified โ โ via$OldCurses[*]:wdeletelninsdellnโ unified โ โ via$OldCurses[*]:winsdellninsertlnโ unified โ โ via$OldCurses[*]:winsertlngetchโ unified โ โ via$OldCurses[*]:wgetch,mvgetch,mvwgetchungetchโ not unifiedhas_keyโ not unifiedKEY_Fโ not unifiedgetstrโ unified โ โ via$OldCurses[*]:wgetstr,mvgetstr,mvwgetstrgetnstrโ unified โ โ via$OldCurses[*]:wgetnstr,mvgetnstr,mvwgetnstrgetyxโ unified โ (no extra spellings listed)getparyxโ unified โ (no extra spellings listed)getbegyxโ unified โ (no extra spellings listed)getmaxyxโ unified โ (no extra spellings listed)inchโ unified โ โ via$OldCurses[*]:winch,mvinch,mvwinchinchstrโ unified โ โ via$OldCurses[*]:winchstr,mvinchstr,mvwinchstrinchnstrโ unified โ โ via$OldCurses[*]:winchnstr,mvinchnstr,mvwinchnstrinitscrโ not unifiedendwinโ not unifiedisendwinโ not unifiednewtermโ not unifiedset_termโ not unifieddelscreenโ not unifiedcbreakโ not unifiednocbreakโ not unifiedechoโ not unifiednoechoโ not unifiedhalfdelayโ not unifiedintrflushโ unified โ (no extra spellings listed)keypadโ unified โ (no extra spellings listed)metaโ unified โ (no extra spellings listed)nodelayโ unified โ (no extra spellings listed)notimeoutโ unified โ (no extra spellings listed)rawโ not unifiednorawโ not unifiedqiflushโ not unifiednoqiflushโ not unifiedtimeoutโ unified โ โ via$OldCurses[*]:wtimeouttypeaheadโ not unifiedinschโ unified โ โ via$OldCurses[*]:winsch,mvinsch,mvwinschinsstrโ unified โ โ via$OldCurses[*]:winsstr,mvinsstr,mvwinsstrinsnstrโ unified โ โ via$OldCurses[*]:winsnstr,mvinsnstr,mvwinsnstrinstrโ unified โ โ via$OldCurses[*]:winstr,mvinstr,mvwinstrinnstrโ unified โ โ via$OldCurses[*]:winnstr,mvinnstr,mvwinnstrdef_prog_modeโ not unifieddef_shell_modeโ not unifiedreset_prog_modeโ not unifiedreset_shell_modeโ not unifiedresettyโ not unifiedsavettyโ not unifiedgetsyxโ not unifiedsetsyxโ not unifiedcurs_setโ not unifiednapmsโ not unifiedmoveโ unified โ โ via$OldCurses[*]:wmoveclearokโ unified โ (no extra spellings listed)idlokโ unified โ (no extra spellings listed)idcokโ unified โ (no extra spellings listed)immedokโ unified โ (no extra spellings listed)leaveokโ unified โ (no extra spellings listed)setscrregโ unified โ โ via$OldCurses[*]:wsetscrregscrollokโ unified โ (no extra spellings listed)nlโ not unifiednonlโ not unifiedoverlayโ not unifiedoverwriteโ not unifiedcopywinโ not unifiednewpadโ not unifiedsubpadโ not unifiedprefreshโ not unifiedpnoutrefreshโ not unifiedpechocharโ not unifiedrefreshโ unified โ โ via$OldCurses[*]:wrefreshnoutrefreshโ unified โ โ via$OldCurses[*]:wnoutrefreshdoupdateโ not unifiedredrawwinโ unified โ (no extra spellings listed)redrawlnโ unified โ โ via$OldCurses[*]:wredrawlnscr_dumpโ not unifiedscr_restoreโ not unifiedscr_initโ not unifiedscr_setโ not unifiedscrollโ unified โ (no extra spellings listed)scrlโ unified โ โ via$OldCurses[*]:wscrlslk_initโ not unifiedslk_setโ not unifiedslk_refreshโ not unifiedslk_noutrefreshโ not unifiedslk_labelโ not unifiedslk_clearโ not unifiedslk_restoreโ not unifiedslk_touchโ not unifiedslk_attronโ not unifiedslk_attrsetโ not unifiedslk_attrโ not unifiedslk_attroffโ not unifiedslk_colorโ not unifiedbaudrateโ not unifiederasecharโ not unifiedhas_icโ not unifiedhas_ilโ not unifiedkillcharโ not unifiedlongnameโ not unifiedtermattrsโ not unifiedtermnameโ not unifiedtouchwinโ unified โ (no extra spellings listed)touchlineโ unified โ (no extra spellings listed)untouchwinโ unified โ (no extra spellings listed)touchlnโ unified โ โ via$OldCurses[*]:wtouchlnis_linetouchedโ unified โ (no extra spellings listed)is_wintouchedโ unified โ (no extra spellings listed)unctrlโ not unifiedkeynameโ not unifiedfilterโ not unifieduse_envโ not unifiedputwinโ not unifiedgetwinโ not unifieddelay_outputโ not unifiedflushinpโ not unifiednewwinโ not unifieddelwinโ unified โ (no extra spellings listed)mvwinโ unified โ (no extra spellings listed)subwinโ unified โ (no extra spellings listed)derwinโ unified โ (no extra spellings listed)mvderwinโ unified โ (no extra spellings listed)dupwinโ unified โ (no extra spellings listed)syncupโ unified โ โ via$OldCurses[*]:wsyncupsyncokโ unified โ (no extra spellings listed)cursyncupโ unified โ โ via$OldCurses[*]:wcursyncupsyncdownโ unified โ โ via$OldCurses[*]:wsyncdowngetmouseโ not unifiedungetmouseโ not unifiedmousemaskโ not unifiedencloseโ unified โ โ via$OldCurses[*]:wenclosemouse_trafoโ unified โ โ via$OldCurses[*]:wmouse_trafomouseintervalโ not unifiedBUTTON_RELEASEโ not unifiedBUTTON_PRESSโ not unifiedBUTTON_CLICKโ not unifiedBUTTON_DOUBLE_CLICKโ not unifiedBUTTON_TRIPLE_CLICKโ not unifiedBUTTON_RESERVED_EVENTโ not unifieduse_default_colorsโ not unifiedassume_default_colorsโ not unifieddefine_keyโ not unifiedkeyboundโ not unifiedkeyokโ not unifiedresizetermโ not unifiedresizeโ unified โ โ via$OldCurses[*]:wresizegetmaxyโ unified โ (no extra spellings listed)getmaxxโ unified โ (no extra spellings listed)flusokโ unified โ (no extra spellings listed)getcapโ not unifiedtouchoverlapโ not unified
okay that was the screen/window chunk, and now we're sliding into panels, then menus, then forms โ three whole libraries stacked up like a little cursed matryoshka ๐ช lock in, we're not done ๐
panels, bestie (all of these say No btw, not a single one is unified)
new_panelโ not unifiedbottom_panelโ not unifiedtop_panelโ not unifiedshow_panelโ not unifiedupdate_panelsโ not unifiedhide_panelโ not unifiedpanel_windowโ not unifiedreplace_panelโ not unifiedmove_panelโ not unifiedpanel_hiddenโ not unifiedpanel_aboveโ not unifiedpanel_belowโ not unifiedset_panel_userptrโ not unifiedpanel_userptrโ not unifieddel_panelโ not unified
and now menus (same situation, all No ๐ธ)
set_menu_foreโ not unifiedmenu_foreโ not unifiedset_menu_backโ not unifiedmenu_backโ not unifiedset_menu_greyโ not unifiedmenu_greyโ not unifiedset_menu_padโ not unifiedmenu_padโ not unifiedpos_menu_cursorโ not unifiedmenu_driverโ not unifiedset_menu_formatโ not unifiedmenu_formatโ not unifiedset_menu_itemsโ not unifiedmenu_itemsโ not unifieditem_countโ not unifiedset_menu_markโ not unifiedmenu_markโ not unifiednew_menuโ not unifiedfree_menuโ not unifiedmenu_optsโ not unifiedset_menu_optsโ not unifiedmenu_opts_onโ not unifiedmenu_opts_offโ not unifiedset_menu_patternโ not unifiedmenu_patternโ not unifiedpost_menuโ not unifiedunpost_menuโ not unifiedset_menu_userptrโ not unifiedmenu_userptrโ not unifiedset_menu_winโ not unifiedmenu_winโ not unifiedset_menu_subโ not unifiedmenu_subโ not unifiedscale_menuโ not unifiedset_current_itemโ not unifiedcurrent_itemโ not unifiedset_top_rowโ not unifiedtop_rowโ not unifieditem_indexโ not unifieditem_nameโ not unifieditem_descriptionโ not unifiednew_itemโ not unifiedfree_itemโ not unifiedset_item_optsโ not unifieditem_opts_onโ not unifieditem_opts_offโ not unifieditem_optsโ not unifieditem_userptrโ not unifiedset_item_userptrโ not unifiedset_item_valueโ not unifieditem_valueโ not unifieditem_visibleโ not unifiedmenu_request_nameโ not unifiedmenu_request_by_nameโ not unifiedset_menu_spacingโ not unifiedmenu_spacingโ not unified
finally forms ๐ฆ (you guessed it โ every single one No)
pos_form_cursorโ not unifieddata_aheadโ not unifieddata_behindโ not unifiedform_driverโ not unifiedset_form_fieldsโ not unifiedform_fieldsโ not unifiedfield_countโ not unifiedmove_fieldโ not unifiednew_formโ not unifiedfree_formโ not unifiedset_new_pageโ not unifiednew_pageโ not unifiedset_form_optsโ not unifiedform_opts_onโ not unifiedform_opts_offโ not unified
okay so we're picking up mid-table, bestie โ no re-intros, just vibes and facts. here's the rest of the availability chart, and every single one of these is a hard No ๐
โ like, not available through Perl "Curses", at all, don't even try:
form_optsโ Noset_current_fieldโ Nocurrent_fieldโ Noset_form_pageโ Noform_pageโ Nofield_indexโ Nopost_formโ Nounpost_formโ Noset_form_userptrโ Noform_userptrโ Noset_form_winโ Noform_winโ Noset_form_subโ Noform_subโ Noscale_formโ Noset_field_foreโ Nofield_foreโ Noset_field_backโ Nofield_backโ Noset_field_padโ Nofield_padโ Noset_field_bufferโ Nofield_bufferโ Noset_field_statusโ Nofield_statusโ Noset_max_fieldโ Nofield_infoโ Nodynamic_field_infoโ Noset_field_justโ Nofield_justโ Nonew_fieldโ Nodup_fieldโ Nolink_fieldโ Nofree_fieldโ Noset_field_optsโ Nofield_opts_onโ Nofield_opts_offโ Nofield_optsโ Noset_field_userptrโ Nofield_userptrโ Nofield_argโ Noform_request_nameโ Noform_request_by_nameโ No
๐ footnote time:[*]To use any functions in this column, the program must set the variable$Curses::OldCursesvariable to a non-zero value before using the"Curses"package. See "Perl 4.X cursperl Compatibility" for an example of this.
โจ Available Wide-Character-Aware Functions โจ
okay this next bit is lowkey iconic โ some functions have a wide-character version, and if you don't have that, they just slide back to the legacy call. it's giving "have you tried both" energy:
Function Uses wide-character call Reverts to legacy call
-------- ------------------------ ----------------------
getchar wget_wch wgetch
getstring wgetn_wstr wgetnstr
ungetchar unget_wch ungetch
instring winnwtr winnstr
addstring waddnwstr waddnstr
insstring wins_nwstr winsnstr
so, spelling it out one by one, no cap:
getcharโ wide call iswget_wch, reverts towgetchgetstringโ wide call iswgetn_wstr, reverts towgetnstrungetcharโ wide call isunget_wch, reverts toungetchinstringโ wide call iswinnwtr, reverts towinnstraddstringโ wide call iswaddnwstr, reverts towaddnstrinsstringโ wide call iswins_nwstr, reverts towinsnstr
๐ธ Available Variables ๐ธ
the whole roster, bestie, and yes these are the actual ones you get:
LINES COLS stdscr
curscr COLORS COLOR_PAIRS
so: LINES, COLS, stdscr, curscr, COLORS, COLOR_PAIRS. that's the set. periodt. ๐
๐ Available Constants ๐
okay this is the big one โ the constants list ate and left no crumbs. every single name, exactly as spelled, because one wrong character and it's not the same symbol:
ERR OK ACS_BLOCK
ACS_BOARD ACS_BTEE ACS_BULLET
ACS_CKBOARD ACS_DARROW ACS_DEGREE
ACS_DIAMOND ACS_HLINE ACS_LANTERN
ACS_LARROW ACS_LLCORNER ACS_LRCORNER
ACS_LTEE ACS_PLMINUS ACS_PLUS
ACS_RARROW ACS_RTEE ACS_S1
ACS_S9 ACS_TTEE ACS_UARROW
ACS_ULCORNER ACS_URCORNER ACS_VLINE
A_ALTCHARSET A_ATTRIBUTES A_BLINK
A_BOLD A_CHARTEXT A_COLOR
A_DIM A_INVIS A_NORMAL
A_PROTECT A_REVERSE A_STANDOUT
A_UNDERLINE A_ITALIC
COLOR_BLACK COLOR_BLUE
COLOR_CYAN COLOR_GREEN COLOR_MAGENTA
COLOR_RED COLOR_WHITE COLOR_YELLOW
KEY_A1 KEY_A3 KEY_B2
KEY_BACKSPACE KEY_BEG KEY_BREAK
KEY_BTAB KEY_C1 KEY_C3
KEY_CANCEL KEY_CATAB KEY_CLEAR
KEY_CLOSE KEY_COMMAND KEY_COPY
KEY_CREATE KEY_CTAB KEY_DC
KEY_DL KEY_DOWN KEY_EIC
KEY_END KEY_ENTER KEY_EOL
KEY_EOS KEY_EVENT KEY_EXIT
KEY_F0
KEY_FIND KEY_HELP KEY_HOME
KEY_IC KEY_IL KEY_LEFT
KEY_LL KEY_MARK KEY_MAX
KEY_MESSAGE KEY_MIN KEY_MOVE
KEY_NEXT KEY_NPAGE KEY_OPEN
KEY_OPTIONS KEY_PPAGE KEY_PREVIOUS
KEY_PRINT KEY_REDO KEY_REFERENCE
KEY_REFRESH KEY_REPLACE KEY_RESET
KEY_RESIZE KEY_RESTART KEY_RESUME
KEY_RIGHT
KEY_SAVE KEY_SBEG KEY_SCANCEL
KEY_SCOMMAND KEY_SCOPY KEY_SCREATE
KEY_SDC KEY_SDL KEY_SELECT
KEY_SEND KEY_SEOL KEY_SEXIT
KEY_SF KEY_SFIND KEY_SHELP
KEY_SHOME KEY_SIC KEY_SLEFT
KEY_SMESSAGE KEY_SMOVE KEY_SNEXT
KEY_SOPTIONS KEY_SPREVIOUS KEY_SPRINT
KEY_SR KEY_SREDO KEY_SREPLACE
KEY_SRESET KEY_SRIGHT KEY_SRSUME
KEY_SSAVE KEY_SSUSPEND KEY_STAB
KEY_SUNDO KEY_SUSPEND KEY_UNDO
KEY_UP KEY_MOUSE BUTTON1_RELEASED
BUTTON1_PRESSED BUTTON1_CLICKED BUTTON1_DOUBLE_CLICKED
BUTTON1_TRIPLE_CLICKED BUTTON1_RESERVED_EVENT BUTTON2_RELEASED
BUTTON2_PRESSED BUTTON2_CLICKED BUTTON2_DOUBLE_CLICKED
BUTTON2_TRIPLE_CLICKED BUTTON2_RESERVED_EVENT BUTTON3_RELEASED
BUTTON3_PRESSED BUTTON3_CLICKED BUTTON3_DOUBLE_CLICKED
BUTTON3_TRIPLE_CLICKED BUTTON3_RESERVED_EVENT BUTTON4_RELEASED
BUTTON4_PRESSED BUTTON4_CLICKED BUTTON4_DOUBLE_CLICKED
BUTTON4_TRIPLE_CLICKED BUTTON4_RESERVED_EVENT BUTTON_CTRL
BUTTON_SHIFT BUTTON_ALT ALL_MOUSE_EVENTS
REPORT_MOUSE_POSITION NCURSES_MOUSE_VERSION E_OK
E_SYSTEM_ERROR E_BAD_ARGUMENT E_POSTED
E_CONNECTED E_BAD_STATE E_NO_ROOM
E_NOT_POSTED E_UNKNOWN_COMMAND E_NO_MATCH
E_NOT_SELECTABLE E_NOT_CONNECTED E_REQUEST_DENIED
E_INVALID_FIELD E_CURRENT REQ_LEFT_ITEM
REQ_RIGHT_ITEM REQ_UP_ITEM REQ_DOWN_ITEM
REQ_SCR_ULINE REQ_SCR_DLINE REQ_SCR_DPAGE
REQ_SCR_UPAGE REQ_FIRST_ITEM REQ_LAST_ITEM
REQ_NEXT_ITEM REQ_PREV_ITEM REQ_TOGGLE_ITEM
REQ_CLEAR_PATTERN REQ_BACK_PATTERN REQ_NEXT_MATCH
REQ_PREV_MATCH MIN_MENU_COMMAND MAX_MENU_COMMAND
O_ONEVALUE O_SHOWDESC O_ROWMAJOR
O_IGNORECASE O_SHOWMATCH O_NONCYCLIC
O_SELECTABLE REQ_NEXT_PAGE REQ_PREV_PAGE
REQ_FIRST_PAGE REQ_LAST_PAGE REQ_NEXT_FIELD
REQ_PREV_FIELD REQ_FIRST_FIELD REQ_LAST_FIELD
REQ_SNEXT_FIELD REQ_SPREV_FIELD REQ_SFIRST_FIELD
REQ_SLAST_FIELD REQ_LEFT_FIELD REQ_RIGHT_FIELD
REQ_UP_FIELD REQ_DOWN_FIELD REQ_NEXT_CHAR
REQ_PREV_CHAR REQ_NEXT_LINE REQ_PREV_LINE
REQ_NEXT_WORD REQ_PREV_WORD REQ_BEG_FIELD
REQ_END_FIELD REQ_BEG_LINE REQ_END_LINE
REQ_LEFT_CHAR REQ_RIGHT_CHAR REQ_UP_CHAR
REQ_DOWN_CHAR REQ_NEW_LINE REQ_INS_CHAR
REQ_INS_LINE REQ_DEL_CHAR REQ_DEL_PREV
REQ_DEL_LINE REQ_DEL_WORD REQ_CLR_EOL
REQ_CLR_EOF REQ_CLR_FIELD REQ_OVL_MODE
REQ_INS_MODE REQ_SCR_FLINE REQ_SCR_BLINE
REQ_SCR_FPAGE REQ_SCR_BPAGE REQ_SCR_FHPAGE
REQ_SCR_BHPAGE REQ_SCR_FCHAR REQ_SCR_BCHAR
REQ_SCR_HFLINE REQ_SCR_HBLINE REQ_SCR_HFHALF
REQ_SCR_HBHALF REQ_VALIDATION REQ_NEXT_CHOICE
REQ_PREV_CHOICE MIN_FORM_COMMAND MAX_FORM_COMMAND
NO_JUSTIFICATION JUSTIFY_LEFT JUSTIFY_CENTER
JUSTIFY_RIGHT O_VISIBLE O_ACTIVE
O_PUBLIC O_EDIT O_WRAP
O_BLANK O_AUTOSKIP O_NULLOK
O_PASSOK O_STATIC O_NL_OVERLOAD
O_BS_OVERLOAD
that's the whole set โ ERR, OK, every ACS_*, every A_*, every COLOR_*, every KEY_*, every BUTTON* / BUTTON_*, ALL_MOUSE_EVENTS, REPORT_MOUSE_POSITION, NCURSES_MOUSE_VERSION, all the E_* errors, all the REQ_*, MIN_MENU_COMMAND, MAX_MENU_COMMAND, all the O_*, NO_JUSTIFICATION, JUSTIFY_*, and MIN_FORM_COMMAND / MAX_FORM_COMMAND. copy them exactly, bestie, character for character. ๐ฅ
๐ Curses functions not available through Perl "Curses" ๐
these ones? nope, not in the package. gatekept. ๐
tstp _putchar fullname scanw wscanw mvscanw mvwscanw ripoffline
setupterm setterm set_curterm del_curterm restartterm tparm tputs
putp vidputs vidattr mvcur tigetflag tigetnum tigetstr tgetent
tgetflag tgetnum tgetstr tgoto tputs
(yes, tputs shows up twice in there โ that's literally how it's written, I'm not fixing it. ๐ญ)
๐ Curses menu functions not available through Perl "Curses" ๐
also not invited to the party:
set_item_init item_init set_item_term item_term set_menu_init
menu_init set_menu_term menu_term
๐ Curses form functions not available through Perl "Curses" ๐
and these too โ same energy, same answer:
new_fieldtype free_fieldtype set_fieldtype_arg
set_fieldtype_choice link_fieldtype set_form_init form_init
set_form_term form_term set_field_init field_init set_field_term
field_term set_field_type field_type
aaand that's the whole page, bestie ๐ซถ you made it to the end, main character behaviour fr fr. this copy is from perl v5.42.0, dated 2025-02-06 โ go build something iconic with it. slay, no cap. ๐โจ๐
๐ฆ where this page comes from
- opensuse-leap 16.0: perl-Curses 1.450.0-bp160.1.9 ยท Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Curses 1.450.0-bp160.1.9 ยท Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Curses 1.450.0-bp160.1.9 ยท Artistic-1.0 OR GPL-1.0-or-later
- opensuse-leap 16.0: perl-Curses 1.450.0-bp160.1.9 ยท Artistic-1.0 OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms