72 | 72 |
static const char *list_head2 = " +- ";
|
73 | 73 |
static const char *list_head3 = " +- ";
|
74 | 74 |
|
75 | |
int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reload, int noreload, int slidenum) {
|
|
75 |
int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reload, int noreload, int slidenum, int nocodebg) {
|
76 | 76 |
|
77 | 77 |
int c = 0; // char
|
78 | 78 |
int i = 0; // iterate
|
|
338 | 338 |
// print lines
|
339 | 339 |
while(line) {
|
340 | 340 |
add_line(content, l + ((LINES - slide->lines_consumed - bar_top - bar_bottom) / 2),
|
341 | |
(COLS - max_cols) / 2, line, max_cols, colors);
|
|
341 |
(COLS - max_cols) / 2, line, max_cols, colors, nocodebg);
|
342 | 342 |
|
343 | 343 |
// raise stop counter if we pass a line having a stop bit
|
344 | 344 |
if(CHECK_BIT(line->bits, IS_STOP))
|
|
564 | 564 |
}
|
565 | 565 |
}
|
566 | 566 |
|
567 | |
void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colors) {
|
|
567 |
void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colors, int nocodebg) {
|
568 | 568 |
|
569 | 569 |
int i; // increment
|
570 | 570 |
int offset = 0; // text offset
|
|
576 | 576 |
|
577 | 577 |
// fill rest off line with spaces if we are in a code block
|
578 | 578 |
if(CHECK_BIT(line->bits, IS_CODE) && colors) {
|
579 | |
if(colors)
|
|
579 |
if(colors && !nocodebg)
|
580 | 580 |
wattron(window, COLOR_PAIR(CP_BLACK));
|
581 | 581 |
for(i = getcurx(window) - x; i < max_cols; i++)
|
582 | 582 |
wprintw(window, "%s", " ");
|
|
610 | 610 |
"%s", prompt);
|
611 | 611 |
|
612 | 612 |
if(!CHECK_BIT(line->bits, IS_CODE))
|
613 | |
inline_display(window, &line->text->value[offset], colors);
|
|
613 |
inline_display(window, &line->text->value[offset], colors, nocodebg);
|
614 | 614 |
|
615 | 615 |
// IS_UNORDERED_LIST_2
|
616 | 616 |
} else if(CHECK_BIT(line->bits, IS_UNORDERED_LIST_2)) {
|
|
633 | 633 |
"%s", prompt);
|
634 | 634 |
|
635 | 635 |
if(!CHECK_BIT(line->bits, IS_CODE))
|
636 | |
inline_display(window, &line->text->value[offset], colors);
|
|
636 |
inline_display(window, &line->text->value[offset], colors, nocodebg);
|
637 | 637 |
|
638 | 638 |
// IS_UNORDERED_LIST_1
|
639 | 639 |
} else if(CHECK_BIT(line->bits, IS_UNORDERED_LIST_1)) {
|
|
651 | 651 |
"%s", prompt);
|
652 | 652 |
|
653 | 653 |
if(!CHECK_BIT(line->bits, IS_CODE))
|
654 | |
inline_display(window, &line->text->value[offset], colors);
|
|
654 |
inline_display(window, &line->text->value[offset], colors, nocodebg);
|
655 | 655 |
}
|
656 | 656 |
|
657 | 657 |
// IS_CODE
|
|
664 | 664 |
}
|
665 | 665 |
|
666 | 666 |
// reverse color for code blocks
|
667 | |
if(colors)
|
|
667 |
if(colors && !nocodebg)
|
668 | 668 |
wattron(window, COLOR_PAIR(CP_BLACK));
|
669 | 669 |
|
670 | 670 |
// print whole lines
|
|
695 | 695 |
offset = next_word(line->text, offset);
|
696 | 696 |
}
|
697 | 697 |
|
698 | |
inline_display(window, &line->text->value[offset], colors);
|
|
698 |
inline_display(window, &line->text->value[offset], colors, nocodebg);
|
699 | 699 |
} else {
|
700 | 700 |
|
701 | 701 |
// IS_CENTER
|
|
728 | 728 |
// no line-wide markdown
|
729 | 729 |
} else {
|
730 | 730 |
|
731 | |
inline_display(window, &line->text->value[offset], colors);
|
|
731 |
inline_display(window, &line->text->value[offset], colors, nocodebg);
|
732 | 732 |
}
|
733 | 733 |
}
|
734 | 734 |
}
|
|
746 | 746 |
wattroff(window, A_UNDERLINE);
|
747 | 747 |
}
|
748 | 748 |
|
749 | |
void inline_display(WINDOW *window, const wchar_t *c, const int colors) {
|
|
749 |
void inline_display(WINDOW *window, const wchar_t *c, const int colors, int nocodebg) {
|
750 | 750 |
const static wchar_t *special = L"\\*_`!["; // list of interpreted chars
|
751 | 751 |
const wchar_t *i = c; // iterator
|
752 | 752 |
const wchar_t *start_link_name, *start_url;
|
|
864 | 864 |
break;
|
865 | 865 |
// enable inline code
|
866 | 866 |
case L'`':
|
867 | |
if(colors)
|
|
867 |
if(colors && !nocodebg)
|
868 | 868 |
wattron(window, COLOR_PAIR(CP_BLACK));
|
869 | 869 |
break;
|
870 | 870 |
// do nothing for backslashes
|