From a23e91e258b38f0aa633b9f5250dad4dc801cacb Mon Sep 17 00:00:00 2001 From: nick black Date: Tue, 10 Aug 2021 20:21:10 -0400 Subject: [PATCH] ncdirect_dump_plane: pass true y to sprite_draw() #2043 --- src/lib/direct.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib/direct.c b/src/lib/direct.c index 4b4ad8a4c..4905ea616 100644 --- a/src/lib/direct.c +++ b/src/lib/direct.c @@ -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)){