From: Ethan Herbertson Date: Wed, 22 Aug 2018 02:05:03 +0000 (-0500) Subject: Add vertical-centering of slide content X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=75c55236b8382936bb41b4d1b11376b0e4a39c3d;p=smdp.git Add vertical-centering of slide content --- diff --git a/include/markdown.h b/include/markdown.h index 7a435a8..8e33c8e 100644 --- a/include/markdown.h +++ b/include/markdown.h @@ -74,6 +74,7 @@ typedef struct _slide_t { struct _slide_t *next; int lines; int stop; + int lines_consumed; } slide_t; typedef struct _deck_t { diff --git a/src/viewer.c b/src/viewer.c index d23ed73..2cf5911 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -158,6 +158,7 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa max_lines_slide = sc; } + slide->lines_consumed = lc; slide = slide->next; ++sc; } @@ -337,7 +338,8 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa // print lines while(line) { - add_line(content, l, (COLS - max_cols) / 2, line, max_cols, colors); + add_line(content, l + ((LINES - slide->lines_consumed - bar_top - bar_bottom) / 2), + (COLS - max_cols) / 2, line, max_cols, colors); // raise stop counter if we pass a line having a stop bit if(CHECK_BIT(line->bits, IS_STOP))