X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=viewer.c;h=e31dbcb2c522a46970c239180023bc59f14b4733;hb=68ae3bc14a97071e67d429970a9176dcde891714;hp=49b61eb4ad6aaf79dbcf4bfeafb934fdb307507c;hpb=8726c79f5d9b9e6308bca14d73ec95ea335e91ed;p=smdp.git diff --git a/viewer.c b/viewer.c index 49b61eb..e31dbcb 100644 --- a/viewer.c +++ b/viewer.c @@ -104,9 +104,19 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) { if((max_cols > COLS) || (max_lines + bar_top + bar_bottom + 2 > LINES)) { + // disable ncurses + endwin(); + + // print error fprintf(stderr, "Error: Terminal size %ix%i too small. Need at least %ix%i.\n", COLS, LINES, max_cols, max_lines + bar_top + bar_bottom + 2); - endwin(); + + // print hint to solve it + if(max_lines + bar_top + bar_bottom + 2 > LINES) + fprintf(stderr, "You may need to add additional horizontal rules ('***') to split your file in shorter slides.\n"); + if(max_cols > COLS) + fprintf(stderr, "Automatic line wrapping is not supported jet. You may need to shorten some lines by inserting line breaks.\n"); + return(1); } @@ -259,6 +269,8 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) { if(slide->prev) { slide = slide->prev; sc--; + } else { + fade = 0; } break; @@ -272,6 +284,8 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) { if(slide->next) { slide = slide->next; sc++; + } else { + fade = 0; } break; @@ -468,6 +482,10 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colo } } else { + // remove backslash from stack + if((stack->top)(stack, '\\')) + (stack->pop)(stack); + // print regular char wprintw(window, "%c", *c); }