diff --git a/src/demo/hud.c b/src/demo/hud.c index 48277b25d..2df32eaec 100644 --- a/src/demo/hud.c +++ b/src/demo/hud.c @@ -93,23 +93,34 @@ debug_toggle(struct notcurses* nc){ if(fclose(mstream)){ return; } - // FIXME base rows on actual lines of output ncplane_options nopts = { .y = 3, .horiz = { .align = NCALIGN_CENTER, }, - .rows = count_debug_lines(output, outputlen) + 2, - .cols = dimx, + .rows = count_debug_lines(output, outputlen) + 1, + .cols = dimx + 1, // so we don't break lines before the true boundary .flags = NCPLANE_OPTION_HORALIGNED, }; - // FIXME create debug window struct ncplane* n = ncplane_create(notcurses_stdplane(nc), &nopts); if(n == NULL){ free(output); return; } - // FIXME fill in window + uint64_t channels = 0; + channels_set_fg_alpha(&channels, CELL_ALPHA_TRANSPARENT); + channels_set_bg_rgb(&channels, 0xffffe5); + ncplane_set_base(n, " ", 0, channels); + ncplane_set_scrolling(n, true); + ncplane_set_fg_rgb(n, 0x0a0a0a); + ncplane_set_bg_rgb(n, 0xffffe5); + if(ncplane_puttext(n, 0, NCALIGN_CENTER, output, &outputlen) < 0){ + free(output); + ncplane_destroy(n); + return; + } + ncplane_putstr_aligned(n, ncplane_dim_y(n) - 1, NCALIGN_CENTER, "Press Alt+d to hide this window"); + free(output); debug = n; } diff --git a/src/lib/debug.c b/src/lib/debug.c index 7f99afed7..f8cad6ede 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -4,7 +4,7 @@ void notcurses_debug(notcurses* nc, FILE* debugfp){ const ncplane* n = nc->top; const ncplane* prev = NULL; int planeidx = 0; - fprintf(debugfp, "*************************** notcurses debug state *****************************\n"); + fprintf(debugfp, " ************************** notcurses debug state *****************************\n"); while(n){ fprintf(debugfp, "%04d off y: %3d x: %3d geom y: %3d x: %3d curs y: %3d x: %3d %p %.8s\n", planeidx, n->absy, n->absx, n->leny, n->lenx, n->y, n->x, n, n->name); @@ -28,5 +28,5 @@ void notcurses_debug(notcurses* nc, FILE* debugfp){ if(nc->bottom != prev){ fprintf(stderr, " WARNING: expected ->bottom %p, got %p\n", prev, nc->bottom); } - fprintf(debugfp, "*******************************************************************************\n"); + fprintf(debugfp, " ******************************************************************************\n"); }