diff --git a/NEWS.md b/NEWS.md index 428dd45f7..eeb6e8e7d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,9 @@ This document attempts to list user-visible changes and any major internal rearrangements of Notcurses. +* 1.6.4 (not yet released) + * Added `notcurses_str_blitter()`. + * 1.6.3 (2020-07-16) * No user-visible changes. diff --git a/USAGE.md b/USAGE.md index b52107abb..51f0f2ca5 100644 --- a/USAGE.md +++ b/USAGE.md @@ -2639,6 +2639,9 @@ typedef enum { NCBLIT_SIXEL, // 6 rows, 1 col (RGB), spotty support among terminals } ncblitter_e; +// Get the name of a blitter. +const char* notcurses_str_blitter(ncblitter_e blitter); + struct ncvisual_options { // if no ncplane is provided, one will be created using the exact size // necessary to render the source with perfect fidelity (this might be diff --git a/doc/man/man3/notcurses_visual.3.md b/doc/man/man3/notcurses_visual.3.md index 0e40cd2d7..017b91069 100644 --- a/doc/man/man3/notcurses_visual.3.md +++ b/doc/man/man3/notcurses_visual.3.md @@ -82,6 +82,8 @@ typedef int (*streamcb)(struct notcurses*, struct ncvisual*, void*); **char* ncvisual_subtitle(const struct ncvisual* ncv);** +**const char* notcurses_str_blitter(ncblitter_e blitter);** + # DESCRIPTION An **ncvisual** is a virtual pixel framebuffer. They can be created from diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 82d37c4d0..4d718cd04 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -895,6 +895,9 @@ typedef struct notcurses_options { // there can be four numbers separated by commas. API int notcurses_lex_margins(const char* op, notcurses_options* opts); +// Get the name of a blitter. +API const char* notcurses_str_blitter(ncblitter_e blitter); + // Lex a visual scaling mode (one of "none", "stretch", or "scale"). API int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode); diff --git a/python/src/notcurses/build_notcurses.py b/python/src/notcurses/build_notcurses.py index a23f27ee8..ea92607c1 100644 --- a/python/src/notcurses/build_notcurses.py +++ b/python/src/notcurses/build_notcurses.py @@ -85,6 +85,7 @@ typedef struct notcurses_options { struct notcurses* notcurses_init(const notcurses_options*, FILE*); void notcurses_version_components(int* major, int* minor, int* patch, int* tweak); int notcurses_lex_margins(const char* op, notcurses_options* opts); +const char* notcurses_str_blitter(ncblitter_e blitter); int notcurses_stop(struct notcurses*); int notcurses_render(struct notcurses*); int notcurses_render_to_file(struct notcurses* nc, FILE* fp); diff --git a/src/lib/blit.c b/src/lib/blit.c index bc737f792..c538e2e9b 100644 --- a/src/lib/blit.c +++ b/src/lib/blit.c @@ -499,6 +499,31 @@ const struct blitset notcurses_blitters[] = { .blit = NULL, .fill = false, }, }; +const char* notcurses_str_blitter(ncblitter_e blitter){ + switch(blitter){ + case NCBLIT_DEFAULT: + return "default"; + case NCBLIT_8x1: + return "eightstep"; + case NCBLIT_1x1: + return "ascii"; + case NCBLIT_2x1: + return "halfblocks"; + case NCBLIT_1x1x4: + return "shadeblocks"; + case NCBLIT_2x2: + return "quadblitter"; + case NCBLIT_4x1: + return "fourstep"; + case NCBLIT_BRAILLE: + return "braille"; + case NCBLIT_SIXEL: + return "sixel"; + default: + return NULL; + } +} + int ncblit_bgrx(const void* data, int linesize, const struct ncvisual_options* vopts){ if(vopts->flags > NCVISUAL_OPTION_BLEND){ return -1; diff --git a/src/lib/terminfo.c b/src/lib/terminfo.c index 5c7b01295..bbf1faf2e 100644 --- a/src/lib/terminfo.c +++ b/src/lib/terminfo.c @@ -72,6 +72,9 @@ int interrogate_terminfo(tinfo* ti){ return -1; } terminfostr(&ti->civis, "civis"); // cursor invisible + if(ti->civis == NULL){ + terminfostr(&ti->civis, "chts");// hard-to-see cursor + } terminfostr(&ti->cnorm, "cnorm"); // cursor normal (undo civis/cvvis) terminfostr(&ti->standout, "smso"); // begin standout mode terminfostr(&ti->uline, "smul"); // begin underline mode diff --git a/src/view/view.cpp b/src/view/view.cpp index a9354e5b6..c3f2c3e76 100644 --- a/src/view/view.cpp +++ b/src/view/view.cpp @@ -61,7 +61,8 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts, clock_gettime(CLOCK_MONOTONIC, &now); intmax_t ns = timespec_to_ns(&now) - timespec_to_ns(start); // clear top line only - stdn->printf(0, NCAlign::Left, "frame %06d\u2026", *framecount); + stdn->printf(0, NCAlign::Left, "frame %06d\u2026 (%s)", *framecount, + notcurses_str_blitter(vopts->blitter)); char* subtitle = ncvisual_subtitle(ncv); if(subtitle){ if(!subtitle_plane){