procroller/fileroller: enable scrolling on standard plane

This commit is contained in:
nick black 2020-06-28 05:50:42 -04:00
parent 6f6826238e
commit 9fe48f8539
2 changed files with 4 additions and 0 deletions

View File

@ -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){

View File

@ -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);