pinosaur
/
smdp.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed dereferencing issue in markdown_load() and removed dead code in free_deck(...
[smdp.git]
/
src
/
viewer.c
diff --git
a/src/viewer.c
b/src/viewer.c
index
6b96ea5
..
50646d7
100644
(file)
--- a/
src/viewer.c
+++ b/
src/viewer.c
@@
-93,7
+93,14
@@
int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) {
lc = 0;
line = slide->line;
lc = 0;
line = slide->line;
- while(line) {
+ while(line && line->text) {
+
+ if (line->text->text)
+ lc += url_count_inline(line->text->text);
+
+ if (line->text->text)
+ line->length -= url_len_inline(line->text->text);
+
if(line->length > COLS) {
i = line->length;
offset = 0;
if(line->length > COLS) {
i = line->length;
offset = 0;
@@
-408,8
+415,13
@@
int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) {
url_purge();
}
url_purge();
}
+ // disable ncurses
endwin();
endwin();
+ // free ncurses memory
+ delwin(content);
+ delwin(stdscr);
+
return 0;
}
return 0;
}
@@
-572,7
+584,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) {
}
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;
const char *i = c; // iterator
const char *start_link_name, *start_url;
int length_link_name, url_num;
@@
-633,7
+645,11
@@
void inline_display(WINDOW *window, const char *c, const int colors) {
*i == '\\') {
// url in pandoc style
*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++;
if (strchr(i, ']')[1] == '(') {
i++;
@@
-662,7
+678,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);
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);
// turn highlighting and underlining off
wattroff(window, A_UNDERLINE);