notcurses_detected_terminal: use termdesc_longterm()

This commit is contained in:
nick black 2021-07-04 07:01:50 -04:00
parent 5451ecd890
commit 50a7996b4f
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
5 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,11 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.3.9 (not yet released)
* `notcurses_detected_terminal()` and `ncdirect_detected_terminal()` now
both return a heap-allocated string, which will contain the terminal
version if Notcurses was able to detect it. This result ought be free()d.
* 2.3.8 (2021-07-04)
* Marked all capability functions `__attribute__ ((pure))`. If you were
calling `notcurses_check_pixel_support()` before in order to enable pixel

View File

@ -47,3 +47,4 @@
* [Jexer](https://jexer.sourceforge.io/) (Java)
* [pygamelib](https://github.com/arnauddupuis/pygamelib) (Python)
* [ctx](https://ctx.graphics/)

View File

@ -1317,8 +1317,10 @@ API unsigned notcurses_supported_styles(const struct notcurses* nc)
API unsigned notcurses_palette_size(const struct notcurses* nc)
__attribute__ ((nonnull (1))) __attribute__ ((pure));
API const char* notcurses_detected_terminal(const struct notcurses* nc)
__attribute__ ((nonnull (1))) __attribute__ ((pure));
// Returns the name (and sometimes version) of the terminal, as Notcurses
// has been best able to determine.
ALLOC API char* notcurses_detected_terminal(const struct notcurses* nc)
__attribute__ ((nonnull (1)));
// Can we directly specify RGB values per cell, or only use palettes?
API bool notcurses_cantruecolor(const struct notcurses* nc)

View File

@ -33,7 +33,7 @@ typedef struct fetched_info {
char* kernver; // strdup(uname(2)->version);
char* desktop; // getenv("XDG_CURRENT_DESKTOP")
const char* shell; // getenv("SHELL")
const char* term; // ncdirect_detected_terminal()
char* term; // ncdirect_detected_terminal(), heap-alloced
char* lang; // getenv("LANG")
int dimy, dimx; // extracted from xrandr
char* cpu_model; // FIXME don't handle hetero setups yet

View File

@ -1700,8 +1700,8 @@ unsigned notcurses_palette_size(const notcurses* nc){
return nc->tcache.caps.colors;
}
const char* notcurses_detected_terminal(const notcurses* nc){
return nc->tcache.termname;
char* notcurses_detected_terminal(const notcurses* nc){
return termdesc_longterm(&nc->tcache);
}
bool notcurses_cantruecolor(const notcurses* nc){