From 774f8e5a23e2f17f4fae98a55e7b5f7ac23c81d6 Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 5 Dec 2019 02:01:49 -0500 Subject: [PATCH] summary: fix minima trackers --- README.md | 19 +++++++------------ include/notcurses.h | 18 ++++++------------ src/demo/sliding.c | 1 + src/lib/input.c | 4 ++-- src/lib/notcurses.c | 4 ++-- src/lib/panelreel.c | 20 ++++++++++---------- 6 files changed, 28 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index b2712745f..76c78f197 100644 --- a/README.md +++ b/README.md @@ -852,18 +852,12 @@ cells_load_box(struct ncplane* n, uint32_t attrs, uint64_t channels, cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl, const char* gclusters){ int ulen; - if((ulen = cell_load(n, ul, gclusters)) > 0){ - if((ulen = cell_load(n, ur, gclusters += ulen)) > 0){ - if((ulen = cell_load(n, ll, gclusters += ulen)) > 0){ - if((ulen = cell_load(n, lr, gclusters += ulen)) > 0){ - if((ulen = cell_load(n, hl, gclusters += ulen)) > 0){ - if((ulen = cell_load(n, vl, gclusters += ulen)) > 0){ - ul->attrword = attrs; ul->channels = channels; - ur->attrword = attrs; ur->channels = channels; - ll->attrword = attrs; ll->channels = channels; - lr->attrword = attrs; lr->channels = channels; - hl->attrword = attrs; hl->channels = channels; - vl->attrword = attrs; vl->channels = channels; + if((ulen = cell_prime(n, ul, gclusters, attrs, channels)) > 0){ + if((ulen = cell_prime(n, ur, gclusters += ulen, attrs, channels)) > 0){ + if((ulen = cell_prime(n, ll, gclusters += ulen, attrs, channels)) > 0){ + if((ulen = cell_prime(n, lr, gclusters += ulen, attrs, channels)) > 0){ + if((ulen = cell_prime(n, hl, gclusters += ulen, attrs, channels)) > 0){ + if((ulen = cell_prime(n, vl, gclusters += ulen, attrs, channels)) > 0){ return 0; } cell_release(n, hl); @@ -879,6 +873,7 @@ cells_load_box(struct ncplane* n, uint32_t attrs, uint64_t channels, return -1; } + static inline int cells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels, cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl){ diff --git a/include/notcurses.h b/include/notcurses.h index 64a830f96..479e69208 100644 --- a/include/notcurses.h +++ b/include/notcurses.h @@ -714,18 +714,12 @@ cells_load_box(struct ncplane* n, uint32_t attrs, uint64_t channels, cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl, const char* gclusters){ int ulen; - if((ulen = cell_load(n, ul, gclusters)) > 0){ - if((ulen = cell_load(n, ur, gclusters += ulen)) > 0){ - if((ulen = cell_load(n, ll, gclusters += ulen)) > 0){ - if((ulen = cell_load(n, lr, gclusters += ulen)) > 0){ - if((ulen = cell_load(n, hl, gclusters += ulen)) > 0){ - if((ulen = cell_load(n, vl, gclusters += ulen)) > 0){ - ul->attrword = attrs; ul->channels = channels; - ur->attrword = attrs; ur->channels = channels; - ll->attrword = attrs; ll->channels = channels; - lr->attrword = attrs; lr->channels = channels; - hl->attrword = attrs; hl->channels = channels; - vl->attrword = attrs; vl->channels = channels; + if((ulen = cell_prime(n, ul, gclusters, attrs, channels)) > 0){ + if((ulen = cell_prime(n, ur, gclusters += ulen, attrs, channels)) > 0){ + if((ulen = cell_prime(n, ll, gclusters += ulen, attrs, channels)) > 0){ + if((ulen = cell_prime(n, lr, gclusters += ulen, attrs, channels)) > 0){ + if((ulen = cell_prime(n, hl, gclusters += ulen, attrs, channels)) > 0){ + if((ulen = cell_prime(n, vl, gclusters += ulen, attrs, channels)) > 0){ return 0; } cell_release(n, hl); diff --git a/src/demo/sliding.c b/src/demo/sliding.c index 9b5a3a1c8..ad1161f4c 100644 --- a/src/demo/sliding.c +++ b/src/demo/sliding.c @@ -133,6 +133,7 @@ draw_bounding_box(struct ncplane* n, int yoff, int xoff, int chunky, int chunkx) int ret; uint64_t channels = 0; notcurses_fg_prep(&channels, 180, 80, 180); + //notcurses_bg_prep(&channels, 0, 0, 0); ncplane_cursor_move_yx(n, yoff, xoff); ret = ncplane_rounded_box(n, 0, channels, CHUNKS_VERT * chunky + yoff + 1, diff --git a/src/lib/input.c b/src/lib/input.c index bb77167eb..cb1c4d6dd 100644 --- a/src/lib/input.c +++ b/src/lib/input.c @@ -234,8 +234,8 @@ int prep_special_keys(notcurses* nc){ continue; } if(seq[0] != ESC){ - fprintf(stderr, "Terminfo's %s is not an escape sequence: %s\n", - k->tinfo, seq); + fprintf(stderr, "Terminfo's %s is not an escape sequence (%zub)\n", + k->tinfo, strlen(seq)); continue; } //fprintf(stderr, "support for terminfo's %s: %s\n", k->tinfo, seq); diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index c0093f8e7..dd77fc3a5 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -600,8 +600,8 @@ notcurses* notcurses_init(const notcurses_options* opts){ return NULL; } memset(&ret->stats, 0, sizeof(ret->stats)); - ret->stats.render_min_ns = ~0UL; - ret->stats.render_min_bytes = ~0UL; + ret->stats.render_min_ns = 1ul << 62u; + ret->stats.render_min_bytes = 1ul << 62u; ret->ttyfp = opts->outfp; ret->renderfp = opts->renderfp; ret->inputescapes = NULL; diff --git a/src/lib/panelreel.c b/src/lib/panelreel.c index 1226e23d7..1ae0c4280 100644 --- a/src/lib/panelreel.c +++ b/src/lib/panelreel.c @@ -60,7 +60,7 @@ int wresize(ncplane* n, int leny, int lenx){ // bchrs: 6-element array of wide border characters + attributes FIXME static int -draw_borders(ncplane* w, unsigned nobordermask, const cell* attr, +draw_borders(ncplane* w, unsigned mask, const cell* attr, bool cliphead, bool clipfoot){ int begx, begy, lenx, leny; int ret = 0; @@ -76,22 +76,22 @@ draw_borders(ncplane* w, unsigned nobordermask, const cell* attr, return -1; } /*fprintf(stderr, "drawing borders %p %d/%d->%d/%d, mask: %04x, clipping: %c%c\n", - w, begx, begy, maxx, maxy, nobordermask, + w, begx, begy, maxx, maxy, mask, cliphead ? 'T' : 't', clipfoot ? 'F' : 'f');*/ if(!cliphead){ // lenx - begx + 1 is the number of columns we have, but drop 2 due to // corners. we thus want lenx - begx - 1 horizontal lines. - if(!(nobordermask & NCBOXMASK_TOP)){ + if(!(mask & NCBOXMASK_TOP)){ ret |= ncplane_cursor_move_yx(w, begy, begx); ncplane_putc(w, &ul); ncplane_hline(w, &hl, lenx - 2); ncplane_putc(w, &ur); }else{ - if(!(nobordermask & NCBOXMASK_LEFT)){ + if(!(mask & NCBOXMASK_LEFT)){ ret |= ncplane_cursor_move_yx(w, begy, begx); ncplane_putc(w, &ul); } - if(!(nobordermask & NCBOXMASK_RIGHT)){ + if(!(mask & NCBOXMASK_RIGHT)){ ret |= ncplane_cursor_move_yx(w, begy, maxx); ncplane_putc(w, &ur); } @@ -99,27 +99,27 @@ draw_borders(ncplane* w, unsigned nobordermask, const cell* attr, } int y; for(y = begy + !cliphead ; y < maxy + !!clipfoot ; ++y){ - if(!(nobordermask & NCBOXMASK_LEFT)){ + if(!(mask & NCBOXMASK_LEFT)){ ret |= ncplane_cursor_move_yx(w, y, begx); ncplane_putc(w, &vl); } - if(!(nobordermask & NCBOXMASK_RIGHT)){ + if(!(mask & NCBOXMASK_RIGHT)){ ret |= ncplane_cursor_move_yx(w, y, maxx); ncplane_putc(w, &vl); } } if(!clipfoot){ - if(!(nobordermask & NCBOXMASK_BOTTOM)){ + if(!(mask & NCBOXMASK_BOTTOM)){ ret |= ncplane_cursor_move_yx(w, maxy, begx); ncplane_putc(w, &ll); ncplane_hline(w, &hl, lenx - 2); ncplane_putc(w, &lr); }else{ - if(!(nobordermask & NCBOXMASK_LEFT)){ + if(!(mask & NCBOXMASK_LEFT)){ ret |= ncplane_cursor_move_yx(w, maxy, begx); ret |= ncplane_putc(w, &ll); } - if(!(nobordermask & NCBOXMASK_RIGHT)){ + if(!(mask & NCBOXMASK_RIGHT)){ // mvwadd_wch returns error if we print to the lowermost+rightmost // character cell. maybe we can make this go away with scrolling controls // at setup? until then, don't check for error here FIXME.