Skip to content

Commit

Permalink
Palliate another effect of rewinding
Browse files Browse the repository at this point in the history
  • Loading branch information
mildsunrise committed Jul 26, 2015
1 parent d52bd1c commit 04c31f8
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/document.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,11 @@ char_autolink_www(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size
HOEDOWN_BUFPUTSL(link_url, "http://");
hoedown_buffer_put(link_url, link->data, link->size);

ob->size -= rewind;
if (ob->size > rewind)
ob->size -= rewind;
else
ob->size = 0;

if (doc->md.normal_text) {
link_text = newbuf(doc, BUFFER_SPAN);
doc->md.normal_text(link_text, link, &doc->data);
Expand Down Expand Up @@ -1036,7 +1040,11 @@ char_autolink_email(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, si
link = newbuf(doc, BUFFER_SPAN);

if ((link_len = hoedown_autolink__email(&rewind, link, data, offset, size, 0)) > 0) {
ob->size -= rewind;
if (ob->size > rewind)
ob->size -= rewind;
else
ob->size = 0;

doc->md.autolink(ob, link, HOEDOWN_AUTOLINK_EMAIL, &doc->data);
}

Expand All @@ -1056,7 +1064,11 @@ char_autolink_url(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size
link = newbuf(doc, BUFFER_SPAN);

if ((link_len = hoedown_autolink__url(&rewind, link, data, offset, size, 0)) > 0) {
ob->size -= rewind;
if (ob->size > rewind)
ob->size -= rewind;
else
ob->size = 0;

doc->md.autolink(ob, link, HOEDOWN_AUTOLINK_NORMAL, &doc->data);
}

Expand Down

0 comments on commit 04c31f8

Please sign in to comment.