úÎ ged‰)      !"#$%&'() ? The getch, wgetch, mvgetch and mvwgetch, routines read a " character from the window. *CGet the current cursor coords, written into the two argument ints.  D The getyx macro places the current cursor position of the given 1 window in the two integer variables y and x. 'void getyx(WINDOW *win, int y, int x); Start it all up A bunch of settings we need +,Like throwIf, but for packed error messages ,Arbitrary test Discard result -packed throwIfNull The standard screen .:initscr is normally the first curses routine to call when * initializing a program. curs_initscr(3):  < To initialize the routines, the routine initscr or newterm < must be called before any of the other routines that deal ( with windows and screens are used. < The initscr code determines the terminal type and initial- < izes all curses data structures. initscr also causes the < first call to refresh to clear the screen. If errors < occur, initscr writes an appropriate error message to < standard error and exits; otherwise, a pointer is returned  to stdscr. /  The cbreak routine < disables line buffering and erase/kill character-process- < ing (interrupt and flow control characters are unaf- < fected), making characters typed by the user immediately < available to the program. The nocbreak routine returns ' the terminal to normal (cooked) mode. 0 < The echo and noecho routines control whether characters < typed by the user are echoed by getch as they are typed. < Echoing by the tty driver is always disabled, but ini- < tially getch is in echo mode, so characters typed are < echoed. Authors of most interactive programs prefer to do < their own echoing in a controlled area of the screen, or < not to echo at all, so they disable echoing by calling < noecho. [See curs_getch(3) for a discussion of how these . routines interact with cbreak and nocbreak.] 1 < The nl and nonl routines control whether the underlying < display device translates the return key into newline on < input, and whether it translates newline into return and < line-feed on output (in either case, the call addch('\n') < does the equivalent of return and line feed on the virtual < screen). Initially, these translations do occur. If you < disable them using nonl, curses will be able to make bet- < ter use of the line-feed capability, resulting in faster < cursor motion. Also, curses will then be able to detect  the return key.  Enable the keypad of the user' s terminal. 2 < The nodelay option causes getch to be a non-blocking call. < If no input is ready, getch returns ERR. If disabled (bf 0 is FALSE), getch waits until a key is pressed. 3 < Normally, the hardware cursor is left at the location of < the window cursor being refreshed. The leaveok option < allows the cursor to be left wherever the update happens < to leave it. It is useful for applications where the cur- < sor is not used, since it reduces the need for cursor < motions. If possible, the cursor is made invisible when  this option is enabled. 4;The use_default_colors() and assume_default_colors() func- > tions are extensions to the curses library. They are used > with terminals that support ISO 6429 color, or equivalent. Duse_default_colors() tells the curses library to assign terminal  default foreground/'background colors to color number -1.  B The program must call endwin for each terminal being used before  exiting from curses. !get the dimensions of the screen 2refresh curses windows and lines. curs_refresh(3) 5;Initialise the color settings, also sets the screen to the ! default colors (white on black)  < curses support color attributes on terminals with that < capability. To use these routines start_color must be < called, usually right after initscr. Colors are always < used in pairs (referred to as color-pairs). A color-pair < consists of a foreground color (for characters) and a < background color (for the blank field on which the charac- < ters are displayed). A programmer initializes a color- < pair with the routine init_pair. After it has been ini- < tialized, COLOR_PAIR(n), a macro defined in <curses.h>, ' can be used as a new video attribute.  < If a terminal is capable of redefining colors, the pro- < grammer can use the routine init_color to change the defi-  nition of a color.  < The init_pair routine changes the definition of a color- < pair. It takes three arguments: the number of the color- < pair to be changed, the foreground color number, and the 6 background color number. For portable applications:  : - The value of the first argument must be between 1 and  COLOR_PAIRS-1. : - The value of the second and third arguments must be : between 0 and COLORS (the 0 color pair is wired to + white on black and cannot be changed). 6"bitwise combination of attributes  / move the cursor associated with the window ? to line y and column x. This routine does not move the ? physical cursor of the terminal until refresh is called. ? The position specified is relative to the upper left-hand * corner of the window, which is (0,0). Set the cursor state B The curs_set routine sets the cursor state is set to B invisible, normal, or very visible for visibility equal to B 0, 1, or 2 respectively. If the terminal supports the B visibility requested, the previous cursor state is - returned; otherwise, ERR is returned. #Get the current cursor coordinates 79Map curses keys to real chars. The lexer will like this. /Some constants for easy symbolic manipulation.  NB we don'1t map keys to an abstract type anymore, as we can't use  Alex lexers then. (!read a character from the window When ESC< followed by another key is pressed before the ESC timeout, B that second character is not returned until a third character is + pressed. wtimeout, nodelay and timeout don't appear to change this  behaviour. @On emacs, we really would want Alt to be our meta key, I think. >Be warned, getCh will block the whole process without noDelay )  !"#$%&'()  (#$"%& !' )  !"#$%&'(8       !"#$%&'()*+,-./0123456789nanocurses-1.5.2UI.Nanocurses.CurseswaddnstrCursorVisibilityCursorVeryVisible CursorVisibleCursorInvisibleAttrColorPair initCurses resetParams throwIfErr_stdScrkeypadendWinscrSizerefresh hasColorscolorinitPairattrSetattr0setBold setReverseattrPlus bkgrndSetclrToEolwMovecursSetgetYXkeyDownkeyUpkeyLeftkeyRightkeyHome keyBackspacekeyNPagekeyPPagekeyEnd keyResizegetChgetch nomacro_getyx throwPackedIf throwIfErrthrowPackedIfNullinitScrcBreakechonlnoDelayleaveOkuseDefaultColors startColorsetAttr decodeKey