demo: make debug plane 81 wide, with transparent last column

pull/1573/head
nick black 3 years ago
parent f4aa419a31
commit c7d284a9af
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -3675,7 +3675,7 @@ API void ncreader_destroy(struct ncreader* n, char** contents);
// Dump selected Notcurses state to the supplied 'debugfp'. Output is freeform,
// newline-delimited, and subject to change. It includes geometry of all
// planes, from all piles. No line has more than 79 columns' worth of output.
// planes, from all piles. No line has more than 80 columns' worth of output.
API void notcurses_debug(const struct notcurses* nc, FILE* debugfp)
__attribute__ ((nonnull (1, 2)));

@ -101,8 +101,12 @@ debug_toggle(struct notcurses* nc){
.y = 3,
.x = NCALIGN_CENTER,
.rows = count_debug_lines(output, outputlen) + 1,
.cols = 80,
// make it one column longer than the maximum debug output, so that a full
// line of output doesn't cause trigger a newline. we'll make the last
// column transparent.
.cols = 81,
.flags = NCPLANE_OPTION_HORALIGNED,
.name = "dbg",
};
struct ncplane* n = ncplane_create(notcurses_stdplane(nc), &nopts);
if(n == NULL){
@ -121,6 +125,13 @@ debug_toggle(struct notcurses* nc){
ncplane_destroy(n);
return;
}
for(int y = 0 ; y < ncplane_dim_y(n) ; ++y){
nccell c = CELL_TRIVIAL_INITIALIZER;
nccell_set_fg_alpha(&c, CELL_ALPHA_TRANSPARENT);
nccell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT);
ncplane_putc_yx(n, y, ncplane_dim_x(n) - 1, &c);
nccell_release(n, &c);
}
ncplane_putstr_aligned(n, ncplane_dim_y(n) - 1, NCALIGN_CENTER, "Press Alt+d to hide this window");
free(output);
debug = n;

@ -63,7 +63,7 @@ ncpile_debug(const ncpile* p, FILE* debugfp){
const ncplane* prev = NULL;
int planeidx = 0;
while(n){
fprintf(debugfp, "%04d off y: %3d x: %3d geom y: %3d x: %3d curs y: %3d x: %3d %p %.7s\n",
fprintf(debugfp, "%04d off y: %3d x: %3d geom y: %3d x: %3d curs y: %3d x: %3d %p %.4s\n",
planeidx, n->absy, n->absx, n->leny, n->lenx, n->y, n->x, n, n->name);
if(n->boundto || n->bnext || n->bprev || n->blist){
fprintf(debugfp, " bound %p ← %p → %p binds %p\n",

Loading…
Cancel
Save