mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
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:
parent
3a4dc02d0f
commit
15bd5cfd56
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user