From 9fe48f85399a3bb3d222b5fba18815267390b748 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 28 Jun 2020 05:50:42 -0400 Subject: [PATCH] procroller/fileroller: enable scrolling on standard plane --- src/poc/fileroller.c | 2 ++ src/poc/procroller.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/poc/fileroller.c b/src/poc/fileroller.c index d77376ac0..facc1d0ed 100644 --- a/src/poc/fileroller.c +++ b/src/poc/fileroller.c @@ -13,6 +13,7 @@ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static int cb(struct ncfdplane* ncfd, const void* data, size_t len, void* curry){ int ret = -1; + // FIXME unsafe -- input isn't necessarily nul-terminated! if(ncplane_putstr(ncfdplane_plane(ncfd), data) >= 0){ if(!notcurses_render(ncplane_notcurses(ncfdplane_plane(ncfd)))){ ret = 0; @@ -46,6 +47,7 @@ int main(int argc, char** argv){ }; struct notcurses* nc = notcurses_init(&opts, NULL); struct ncplane* n = notcurses_stdplane(nc); + ncplane_set_scrolling(n, true); while(*++argv){ int fd = open(*argv, O_RDONLY|O_CLOEXEC); if(fd < 0){ diff --git a/src/poc/procroller.c b/src/poc/procroller.c index 2a2005d52..1f0f78679 100644 --- a/src/poc/procroller.c +++ b/src/poc/procroller.c @@ -13,6 +13,7 @@ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static int cb(struct ncfdplane* ncfd, const void* data, size_t len, void* curry){ int ret = -1; + // FIXME unsafe -- input isn't necessarily nul-terminated! if(ncplane_putstr(ncfdplane_plane(ncfd), data) >= 0){ if(!notcurses_render(ncplane_notcurses(ncfdplane_plane(ncfd)))){ ret = 0; @@ -50,6 +51,7 @@ int main(int argc, char** argv){ } ++argv; struct ncplane* n = notcurses_stdplane(nc); + ncplane_set_scrolling(n, true); ncsubproc_options nopts = {}; struct ncsubproc* nsproc = ncsubproc_createvp(n, &nopts, *argv, argv, cb, eofcb); pthread_mutex_lock(&lock);