notcurses-view: properly handle resize

Since notcurses-view is now rendering to the standard plane, and
ncvisual is no longer bound to a plane, there's no need to call
ncplane_resize() (and doing so fails, since you can't resize the
standard plane). Remove the call, leave the check. Fixes resizing.
This commit is contained in:
nick black 2020-06-01 22:34:12 -04:00
parent 3a4dc02d0f
commit 15bd5cfd56
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -92,11 +92,9 @@ auto perframe(struct ncplane* n, struct ncvisual* ncv,
if(!nc.render()){ if(!nc.render()){
return -1; return -1;
} }
int dimx, dimy, oldx, oldy, keepy, keepx; int dimx, dimy, oldx, oldy;
nc.get_term_dim(&dimy, &dimx); nc.get_term_dim(&dimy, &dimx);
ncplane_dim_yx(n, &oldy, &oldx); ncplane_dim_yx(n, &oldy, &oldx);
keepy = oldy > dimy ? dimy : oldy;
keepx = oldx > dimx ? dimx : oldx;
struct timespec interval; struct timespec interval;
clock_gettime(CLOCK_MONOTONIC, &interval); clock_gettime(CLOCK_MONOTONIC, &interval);
uint64_t nsnow = timespec_to_ns(&interval); uint64_t nsnow = timespec_to_ns(&interval);
@ -106,7 +104,7 @@ auto perframe(struct ncplane* n, struct ncvisual* ncv,
char32_t keyp; char32_t keyp;
while((keyp = nc.getc(&interval, nullptr, nullptr)) != (char32_t)-1){ while((keyp = nc.getc(&interval, nullptr, nullptr)) != (char32_t)-1){
if(keyp == NCKEY_RESIZE){ if(keyp == NCKEY_RESIZE){
return ncplane_resize(n, 0, 0, keepy, keepx, 0, 0, dimy, dimx); return 0;
} }
return 1; return 1;
} }