From 5cd3a4c41d63fb0d6f63706a75771e818b59984d Mon Sep 17 00:00:00 2001 From: nick black Date: Tue, 4 Feb 2020 03:04:38 -0500 Subject: [PATCH] ncdirect_dim_y()/x() --- README.md | 5 ++--- doc/man/man3/notcurses_directmode.3.md | 7 +++++++ doc/man/man3/notcurses_selector.3.md | 2 -- include/notcurses.h | 7 ++++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 838d9f192..a723b2a28 100644 --- a/README.md +++ b/README.md @@ -354,6 +354,8 @@ int ncdirect_bg_rgb8(struct ncdirect* nc, unsigned r, unsigned g, unsigned b); int ncdirect_fg_rgb8(struct ncdirect* nc, unsigned r, unsigned g, unsigned b); int ncdirect_fg(struct ncdirect* nc, unsigned rgb); int ncdirect_bg(struct ncdirect* nc, unsigned rgb); +int ncdirect_dim_x(const struct ncdirect* nc); +int ncdirect_dim_y(const struct ncdirect* nc); ``` ### Alignment @@ -2169,9 +2171,6 @@ struct ncselector; struct ncselector* ncselector_create(struct ncplane* n, int y, int x, const selector_options* opts); -struct ncselector* ncselector_aligned(struct ncplane* n, int y, ncalign_e align, - const selector_options* opts); - int ncselector_additem(struct ncselector* n, const struct selector_item* item); int ncselector_delitem(struct ncselector* n, const char* item); diff --git a/doc/man/man3/notcurses_directmode.3.md b/doc/man/man3/notcurses_directmode.3.md index 2779ecca3..11df6f1d3 100644 --- a/doc/man/man3/notcurses_directmode.3.md +++ b/doc/man/man3/notcurses_directmode.3.md @@ -20,6 +20,9 @@ notcurses_directmode - minimal notcurses instances for styling text **int ncdirect_bg(struct ncdirect* nc, unsigned rgb);** +**int ncdirect_dim_x(const struct ncdirect* nc);** +**int ncdirect_dim_y(const struct ncdirect* nc);** + **int ncdirect_stop(struct ncdirect* nc);** # DESCRIPTION @@ -38,6 +41,10 @@ display capabilities, and/or display errors. notcurses natively targets 24bpp/8bpc RGB color, and it is thus desirable to use a terminal with the **rgb** capability (e.g. xterm's **xterm-direct**). +**ncdirect_dim_x** returns the current number of columns, and **ncdirect_dim_y** +the current number of rows. + + # RETURN VALUES **notcurses_directmode** returns **NULL** on failure. Otherwise, the return diff --git a/doc/man/man3/notcurses_selector.3.md b/doc/man/man3/notcurses_selector.3.md index cba39c21b..b6a4fc63f 100644 --- a/doc/man/man3/notcurses_selector.3.md +++ b/doc/man/man3/notcurses_selector.3.md @@ -40,8 +40,6 @@ typedef struct selector_options { **struct ncselector* ncselector_create(struct ncplane* n, int y, int x, const selector_options* opts);** -**struct ncselector* ncselector_aligned(struct ncplane* n, int y, ncalign_e align, const selector_options* opts);** - **int ncselector_additem(struct ncselector* n, const struct selector_item* item);** **int ncselector_delitem(struct ncselector* n, const char* item);** diff --git a/include/notcurses.h b/include/notcurses.h index cc4bd7da2..9a095a227 100644 --- a/include/notcurses.h +++ b/include/notcurses.h @@ -195,6 +195,10 @@ API struct notcurses* notcurses_init(const notcurses_options* opts, FILE* fp); // including any failure initializing terminfo. API struct ncdirect* notcurses_directmode(const char* termtype, FILE* fp); +// Get the current number of columns/rows. +API int ncdirect_dim_x(const struct ncdirect* nc); +API int ncdirect_dim_y(const struct ncdirect* nc); + // Destroy a notcurses context. API int notcurses_stop(struct notcurses* nc); @@ -2183,9 +2187,6 @@ struct ncselector; API struct ncselector* ncselector_create(struct ncplane* n, int y, int x, const selector_options* opts); -API struct ncselector* ncselector_aligned(struct ncplane* n, int y, ncalign_e align, - const selector_options* opts); - API int ncselector_additem(struct ncselector* n, const struct selector_item* item); API int ncselector_delitem(struct ncselector* n, const char* item);