LibMarkdown: Fix breakage from Vector using size_t

It's no longer possible rely on negative VectorIterator when iterating
backwards. It would be nice to have a general solution for reverse
iteration, but for now let me just patch this up.
This commit is contained in:
Andreas Kling 2020-02-29 17:06:57 +01:00
parent 9cf92831e3
commit 70b940c307

View file

@ -73,8 +73,8 @@ String MDText::render_to_html() const
// not be open for the new span. Close // not be open for the new span. Close
// it and all the open tags that follow // it and all the open tags that follow
// it. // it.
for (auto it2 = --open_tags.end(); it2 >= it; --it2) { for (ssize_t j = open_tags.size() - 1; j >= static_cast<ssize_t>(it.index()); --j) {
const String& tag = *it2; auto& tag = open_tags[j];
builder.appendf("</%s>", tag.characters()); builder.appendf("</%s>", tag.characters());
if (tag == "a") { if (tag == "a") {
current_style.href = {}; current_style.href = {};
@ -101,8 +101,8 @@ String MDText::render_to_html() const
builder.append(span.text); builder.append(span.text);
} }
for (auto it = --open_tags.end(); it >= open_tags.begin(); --it) { for (ssize_t i = open_tags.size() - 1; i >= 0; --i) {
const String& tag = *it; auto& tag = open_tags[i];
builder.appendf("</%s>", tag.characters()); builder.appendf("</%s>", tag.characters());
} }