add notcurses_stddim_yx_const()

This commit is contained in:
nick black 2020-10-19 01:37:31 -04:00
parent fe7eededa8
commit 0b825c619e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 18 additions and 0 deletions

View File

@ -9,6 +9,7 @@ rearrangements of Notcurses.
* Add `ncinput_equal_p()` for comparison of `ncinput` structure data. * Add `ncinput_equal_p()` for comparison of `ncinput` structure data.
* `ncmenu_offer_input()` now recognizes the shortcuts for registered * `ncmenu_offer_input()` now recognizes the shortcuts for registered
sections, and will unroll the appropriate section when given input. sections, and will unroll the appropriate section when given input.
* Added `notcurses_stddim_yx_const()` (`notcurses_stddim_yx()` `const` form).
* 2.0.0 (2020-10-12) "Stankonia" * 2.0.0 (2020-10-12) "Stankonia"
* **API STABILITY!** The API expressed in 2.0.0 will be maintained throughout * **API STABILITY!** The API expressed in 2.0.0 will be maintained throughout

View File

@ -207,6 +207,14 @@ notcurses_stddim_yx(struct notcurses* nc, int* restrict y, int* restrict x){
ncplane_dim_yx(s, y, x); // accepts NULL ncplane_dim_yx(s, y, x); // accepts NULL
return s; return s;
} }
static inline const struct ncplane*
notcurses_stddim_yx_const(const struct notcurses* nc, int* restrict y, int* restrict x){
const struct ncplane* s = notcurses_stdplane_const(nc); // can't fail
ncplane_dim_yx(s, y, x); // accepts NULL
return s;
}
``` ```
A reference to the standard plane *is* persistent across a screen resize, as are A reference to the standard plane *is* persistent across a screen resize, as are

View File

@ -16,6 +16,8 @@ notcurses_stdplane - acquire the standard ncplane
**static inline struct ncplane* notcurses_stddim_yx(struct notcurses* nc, int* restrict y, int* restrict x);** **static inline struct ncplane* notcurses_stddim_yx(struct notcurses* nc, int* restrict y, int* restrict x);**
**static inline const struct ncplane* notcurses_stddim_yx_const(const struct notcurses* nc, int* restrict y, int* restrict x);**
# DESCRIPTION # DESCRIPTION
**notcurses_stdplane** returns a handle to the standard ncplane for the context **notcurses_stdplane** returns a handle to the standard ncplane for the context

View File

@ -991,6 +991,13 @@ notcurses_stddim_yx(struct notcurses* nc, int* RESTRICT y, int* RESTRICT x){
return s; return s;
} }
static inline const struct ncplane*
notcurses_stddim_yx_const(const struct notcurses* nc, int* RESTRICT y, int* RESTRICT x){
const struct ncplane* s = notcurses_stdplane_const(nc); // can't fail
ncplane_dim_yx(s, y, x); // accepts NULL
return s;
}
static inline int static inline int
ncplane_dim_y(const struct ncplane* n){ ncplane_dim_y(const struct ncplane* n){
int dimy; int dimy;