From 636101578ce9ac2588ce734f9b36f38809beddd5 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 11 Aug 2021 17:16:53 -0400 Subject: [PATCH] ncneofetch: bring neologo_present() into csi mode --- src/fetch/main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/fetch/main.c b/src/fetch/main.c index ba665dec9..857a3b395 100644 --- a/src/fetch/main.c +++ b/src/fetch/main.c @@ -519,20 +519,22 @@ neologo_present(struct notcurses* nc, const char* nlogo){ maxlinelen = collen; } } - const int leftpad = (ncdirect_dim_x(nc) - maxlinelen) / 2; + int dimy, dimx; + struct ncplane* n = notcurses_stddim_yx(nc, &dimy, &dimx); + const int leftpad = (dimx - maxlinelen) / 2; for(int i = 0 ; i < linecount ; ++i){ printf("%*.*s%s", leftpad, leftpad, "", lines[i]); free(lines[i]); } free(lines); - ncdirect_set_fg_default(nc); - ncdirect_on_styles(nc, NCSTYLE_BOLD | NCSTYLE_ITALIC); - if(ncdirect_canopen_images(nc)){ - ncdirect_printf_aligned(nc, -1, NCALIGN_CENTER, "(no image file is known for your distro)"); + ncplane_set_fg_default(n); + ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_ITALIC); + if(notcurses_canopen_images(nc)){ + ncplane_putstr_aligned(n, -1, NCALIGN_CENTER, "(no image file is known for your distro)"); }else{ - ncdirect_printf_aligned(nc, -1, NCALIGN_CENTER, "(notcurses was compiled without image support)"); + ncplane_putstr_aligned(n, -1, NCALIGN_CENTER, "(notcurses was compiled without image support)"); } - ncdirect_off_styles(nc, NCSTYLE_BOLD | NCSTYLE_ITALIC); + ncplane_off_styles(n, NCSTYLE_BOLD | NCSTYLE_ITALIC); return 0; }