ncdirect_dump_plane: pass true y to sprite_draw() #2043

This commit is contained in:
nick black 2021-08-10 20:21:10 -04:00
parent 9a6389661e
commit a23e91e258
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -504,12 +504,13 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np, int xoff){
int dimy, dimx;
ncplane_dim_yx(np, &dimy, &dimx);
if(np->sprite){
if(xoff){
// doing an x-move without specifying the y coordinate requires asking
// the terminal where the cursor currently is.
if(ncdirect_cursor_move_yx(n, -1, xoff)){
return -1;
}
int y;
const char* u7 = get_escape(&n->tcache, ESCAPE_U7);
if(cursor_yx_get(n->tcache.ttyfd, u7, &y, NULL)){
return -1;
}
if(ncdirect_cursor_move_yx(n, y, xoff)){
return -1;
}
// flush our FILE*, as we're about to use UNIX I/O (since we can't rely on
// stdio to transfer large amounts at once).
@ -520,7 +521,7 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np, int xoff){
if(fbuf_init(&f)){
return -1;
}
if(sprite_draw(&n->tcache, NULL, np->sprite, &f, 0, xoff) < 0){
if(sprite_draw(&n->tcache, NULL, np->sprite, &f, y, xoff) < 0){
return -1;
}
if(sprite_commit(&n->tcache, &f, np->sprite, true)){