From b0c4a3af97b62e1742ec902a40dff79f8756f228 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 19 Sep 2021 18:16:21 -0400 Subject: [PATCH] direct_dump_cellplane: position all lines according to xoff --- src/lib/direct.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/direct.c b/src/lib/direct.c index 16f24dcce..9557f080e 100644 --- a/src/lib/direct.c +++ b/src/lib/direct.c @@ -519,7 +519,7 @@ ncdirect_set_fg_default_f(ncdirect* nc, fbuf* f){ } static int -ncdirect_dump_cellplane(ncdirect* n, const ncplane* np, fbuf* f){ +ncdirect_dump_cellplane(ncdirect* n, const ncplane* np, fbuf* f, int xoff){ int dimy, dimx; ncplane_dim_yx(np, &dimy, &dimx); const int toty = ncdirect_dim_y(n); @@ -560,7 +560,7 @@ ncdirect_dump_cellplane(ncdirect* n, const ncplane* np, fbuf* f){ // FIXME replace with a SGR clear ncdirect_set_fg_default_f(n, f); ncdirect_set_bg_default_f(n, f); - if(fbuf_putc(f, '\n') < 0){ + if(fbuf_printf(f, "\n%*.*s", xoff, xoff, "") < 0){ return -1; } if(y == toty){ @@ -618,7 +618,7 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np, int xoff){ return -1; } }else{ - if(ncdirect_dump_cellplane(n, np, &f)){ + if(ncdirect_dump_cellplane(n, np, &f, xoff)){ fbuf_free(&f); return -1; }