clear to end of line in init banner, if el is available #2134

pull/2148/head
nick black 3 years ago
parent 108012950e
commit 83bb816c15
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -4,12 +4,14 @@
// only invoked without suppress banners flag. prints various warnings based on
// the environment / terminal definition. returns the number of lines printed.
static int
init_banner_warnings(const notcurses* nc, fbuf* f){
init_banner_warnings(const notcurses* nc, fbuf* f, const char* clreol){
term_fg_palindex(nc, f, nc->tcache.caps.colors <= 88 ? 1 : 0xcb);
if(!notcurses_canutf8(nc)){
fbuf_puts(f, clreol);
fbuf_puts(f, " Warning! Encoding is not UTF-8; output may be degraded.\n");
}
if(!get_escape(&nc->tcache, ESCAPE_HPA)){
fbuf_puts(f, clreol);
fbuf_puts(f, " Warning! No absolute horizontal placement.\n");
}
return 0;
@ -18,15 +20,21 @@ init_banner_warnings(const notcurses* nc, fbuf* f){
// unless the suppress_banner flag was set, print some version information and
// (if applicable) warnings to ttyfp. we are not yet on the alternate screen.
int init_banner(const notcurses* nc, fbuf* f){
const char* clreol = get_escape(&nc->tcache, ESCAPE_EL);
if(clreol == NULL){
clreol = "";
}
if(!nc->suppress_banner){
term_fg_palindex(nc, f, 50 % nc->tcache.caps.colors);
fbuf_printf(f, "notcurses %s on %s %s\n", notcurses_version(),
fbuf_printf(f, "%snotcurses %s on %s %s\n", notcurses_version(),
clreol,
nc->tcache.termname ? nc->tcache.termname : "?",
nc->tcache.termversion ? nc->tcache.termversion : "");
term_fg_palindex(nc, f, nc->tcache.caps.colors <= 256 ?
14 % nc->tcache.caps.colors : 0x2080e0);
if(nc->tcache.cellpixy && nc->tcache.cellpixx){
fbuf_printf(f, "%d rows (%dpx) %d cols (%dpx) %dx%d ",
fbuf_printf(f, "%s%d rows (%dpx) %d cols (%dpx) %dx%d ",
clreol,
nc->stdplane->leny, nc->tcache.cellpixy,
nc->stdplane->lenx, nc->tcache.cellpixx,
nc->stdplane->leny * nc->tcache.cellpixy,
@ -46,8 +54,8 @@ int init_banner(const notcurses* nc, fbuf* f){
14 % nc->tcache.caps.colors : 0x2080e0);
fbuf_putc(f, '+');
}
fbuf_printf(f, "%u colors\n%s%s (%s)\nterminfo from %s zlib %s GPM %s\n",
nc->tcache.caps.colors,
fbuf_printf(f, "%u colors\n%s%s%s (%s)\n%sterminfo from %s zlib %s GPM %s\n",
nc->tcache.caps.colors, clreol,
#ifdef __clang__
"", // name is contained in __VERSION__
#else
@ -67,9 +75,10 @@ int init_banner(const notcurses* nc, fbuf* f){
#else
#error "No __BYTE_ORDER__ definition"
#endif
curses_version(), zlibVersion(), gpm_version());
clreol, curses_version(), zlibVersion(), gpm_version());
fbuf_puts(f, clreol); // for ncvisual banner
ncvisual_printbanner(f);
init_banner_warnings(nc, f);
init_banner_warnings(nc, f, clreol);
const char* esc;
if( (esc = get_escape(&nc->tcache, ESCAPE_SGR0)) ||
(esc = get_escape(&nc->tcache, ESCAPE_OP))){

Loading…
Cancel
Save