X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=src%2Fviewer.c;h=0e2da5893e7960c8485222a2573d49562a495d91;hb=e9663e348e5e5d36b36ec38a582df7df1fc9126b;hp=6b96ea52523f8cbbd94877433a96aff8a2d3f724;hpb=434d0d1b561b64b99e9d60a704b82fac6e9d4b8e;p=smdp.git diff --git a/src/viewer.c b/src/viewer.c index 6b96ea5..0e2da58 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -94,6 +94,13 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) { line = slide->line; while(line) { + + if (line && line->text && line->text->text) + lc += url_count_inline(line->text->text); + + if (line && line->text && line->text->text) + line->length -= url_len_inline(line->text->text); + if(line->length > COLS) { i = line->length; offset = 0; @@ -572,7 +579,7 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colo } void inline_display(WINDOW *window, const char *c, const int colors) { - const static char *special = "\\*_`["; // list of interpreted chars + const static char *special = "\\*_`!["; // list of interpreted chars const char *i = c; // iterator const char *start_link_name, *start_url; int length_link_name, url_num; @@ -633,7 +640,11 @@ void inline_display(WINDOW *window, const char *c, const int colors) { *i == '\\') { // url in pandoc style - if (*i == '[' && strchr(i, ']')) { + if ((*i == '[' && strchr(i, ']')) || + (*i == '!' && *(i + 1) == '[' && strchr(i, ']'))) { + + if (*i == '!') i++; + if (strchr(i, ']')[1] == '(') { i++; @@ -662,7 +673,7 @@ void inline_display(WINDOW *window, const char *c, const int colors) { url_num = url_add(start_link_name, length_link_name, start_url, i - start_url, 0,0); - wprintw(window, "[%d]", url_num); + wprintw(window, " [%d]", url_num); // turn highlighting and underlining off wattroff(window, A_UNDERLINE);