document NCOPTION_PRESERVE_CURSOR #1823

This commit is contained in:
nick black 2021-06-24 07:13:16 -04:00 committed by Nick Black
parent fd8875e757
commit 166212f234
4 changed files with 22 additions and 1 deletions

View File

@ -3,6 +3,11 @@ rearrangements of Notcurses.
* 2.3.7 (not yet released)
* Deprecated `NCSTYLE_REVERSE` and `NCSTYLE_DIM`. The remainder are safe.
* Added `NCOPTION_PRESERVE_CURSOR`. If used, the standard plane's virtual
cursor will be initialized to match its position at startup, rather than
starting in the upper-left corner. Together with a scrolling standard
plane and inhibition of the alternate screen, this allows rendered mode
to easily be used for scrolling shell environment programs.
* 2.3.6 (2021-06-23)
* Fixed (harmless) warning with `-Wformat-security`.

View File

@ -15,6 +15,7 @@ notcurses_init - initialize a notcurses instance
#define NCOPTION_NO_CLEAR_BITMAPS 0x0002ull
#define NCOPTION_NO_WINCH_SIGHANDLER 0x0004ull
#define NCOPTION_NO_QUIT_SIGHANDLERS 0x0008ull
#define NCOPTION_PRESERVE_CURSOR 0x0010ull
#define NCOPTION_SUPPRESS_BANNERS 0x0020ull
#define NCOPTION_NO_ALTERNATE_SCREEN 0x0040ull
#define NCOPTION_NO_FONT_CHANGES 0x0080ull
@ -204,6 +205,12 @@ relevant with echoed user input, and you don't want echoed user input in
rendered mode (instead, read the input, and write it to a plane yourself).
A subprocess can be streamed to a plane with an **ncsubproc**, etc.
If the **NCOPTION_PRESERVE_CURSOR** flag is provided, the cursor's location
will be determined at startup, and the standard plane's virtual cursor will
be placed to match it (instead of in the upper-left corner). Combined with
**NCOPTION_NO_ALTERNATE_SCREEN** and a scrolling standard plane, this allows
rendered mode to be used as a normal scrolling shell application.
# RETURN VALUES
**NULL** is returned on failure. Otherwise, the return value points at a valid

View File

@ -26,6 +26,11 @@ screen. It is an error to call **ncplane_destroy(3)**, **ncplane_resize(3)**,
or **ncplane_move(3)** on the standard plane, but it can be freely moved
along the z-axis.
The standard plane's virtual cursor is initialized to its uppermost, leftmost
cell unless **NCOPTION_PRESERVE_CURSOR** is provided (see
**notcurses_init(3)**), in which case it is placed wherever the terminal's
real cursor was at startup.
**notcurses_stddim_yx** provides the same function, but also writes the
dimensions of the standard plane (and thus the real drawable area) into any
non-**NULL** parameters among **y** and **x**.

View File

@ -854,7 +854,11 @@ typedef enum {
// to inhibit registration of these signal handlers.
#define NCOPTION_NO_QUIT_SIGHANDLERS 0x0008ull
// NCOPTION_RETAIN_CURSOR was removed in 1.6.18. It ought be repurposed. FIXME.
// Initialize the standard plane's virtual cursor to match the physical cursor
// at context creation time. Together with NCOPTION_NO_ALTERNATE_SCREEN and a
// scrolling standard plane, this facilitates easy scrolling-style programs in
// rendered mode.
#define NCOPTION_PRESERVE_CURSOR 0x0010ull
// Notcurses typically prints version info in notcurses_init() and performance
// info in notcurses_stop(). This inhibits that output.