X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=src%2Fviewer.c;h=2cf5911b2e112a5f9a1d97d2763aded3d7cdecff;hb=75c55236b8382936bb41b4d1b11376b0e4a39c3d;hp=cbb1498f73746f889506272642bbbd17a7586ff1;hpb=4ebae8ba8f3700f740d2705f7a3c2dc92f4995dc;p=smdp.git diff --git a/src/viewer.c b/src/viewer.c index cbb1498..2cf5911 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -2,7 +2,7 @@ * Functions necessary to display a deck of slides in different color modes * using ncurses. Only white, red, and blue are supported, as they can be * faded in 256 color mode. - * Copyright (C) 2016 Michael Goehler + * Copyright (C) 2018 Michael Goehler * * This file is part of mdp. * @@ -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; } @@ -261,7 +262,7 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa slide = deck->slide; // find slide to reload - sc = 0; + sc = 1; while(reload > 1 && reload <= deck->slides) { 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)) @@ -656,7 +658,8 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colo // IS_CODE if(CHECK_BIT(line->bits, IS_CODE)) { - if (!CHECK_BIT(line->bits, IS_TILDE_CODE)) { + if (!CHECK_BIT(line->bits, IS_TILDE_CODE) && + !CHECK_BIT(line->bits, IS_GFM_CODE)) { // set static offset for code offset = CODE_INDENT; } @@ -981,7 +984,7 @@ int int_length (int val) { int get_slide_number(char init) { int retval = init - '0'; - char c; + int c; // block for tenths of a second when using getch, ERR if no input halfdelay(GOTO_SLIDE_DELAY); while((c = getch()) != ERR) {