From 750518c091ae77cb46c5a6bd2db49f58beda6fe0 Mon Sep 17 00:00:00 2001 From: nick black Date: Tue, 26 Nov 2019 06:25:03 -0500 Subject: [PATCH] uniblock: only render at end of a block #41 --- src/bin/unicodeblocks.c | 6 +++--- src/lib/notcurses.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/unicodeblocks.c b/src/bin/unicodeblocks.c index 40d781684..0a2c197c0 100644 --- a/src/bin/unicodeblocks.c +++ b/src/bin/unicodeblocks.c @@ -112,9 +112,9 @@ int unicodeblocks_demo(struct notcurses* nc){ } } cell_release(n, &c); - if(notcurses_render(nc)){ - return -1; - } + } + if(notcurses_render(nc)){ + return -1; } usleep(10000); // for a 32-bit wchar_t, we would want up through 24 bits of block ID. but diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 9091aaba7..f66bfd3c0 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -576,7 +576,7 @@ int notcurses_render(notcurses* nc){ int y, x; char* buf = NULL; size_t buflen = 0; - FILE* out = open_memstream(&buf, &buflen); + FILE* out = open_memstream(&buf, &buflen); // worth keeping around? if(out == NULL){ return -1; } @@ -600,7 +600,7 @@ int notcurses_render(notcurses* nc){ } } ret |= fclose(out); - printf("%.*s", (int)buflen, buf); + printf("%s", buf); clock_gettime(CLOCK_MONOTONIC, &done); free(buf); update_render_stats(&done, &start, &nc->stats);