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);
}
void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colors) {
int i = 0; // increment
char *c; // char pointer for iteration
- char *special = "\\*_"; // list of interpreted chars
+ char *special = "\\*_`"; // list of interpreted chars
cstack_t *stack = cstack_init();
if(line->text->text) {
case '_':
wattroff(window, A_UNDERLINE);
break;
+ // disable inline code
+ case '`':
+ wattroff(window, A_REVERSE);
+ break;
}
// remove top special char from stack
case '_':
wattron(window, A_UNDERLINE);
break;
+ // enable inline code
+ case '`':
+ wattron(window, A_REVERSE);
+ break;
// do nothing for backslashes
}
}
} else {
+ // remove backslash from stack
+ if((stack->top)(stack, '\\'))
+ (stack->pop)(stack);
+
// print regular char
wprintw(window, "%c", *c);
}
case '_':
wattroff(window, A_UNDERLINE);
break;
+ // disable inline code
+ case '`':
+ wattroff(window, A_REVERSE);
+ break;
// do nothing for backslashes
}
}