diff --git a/hgmarkdownhighlighter.cpp b/hgmarkdownhighlighter.cpp index 6510c371..6ec1c6b1 100644 --- a/hgmarkdownhighlighter.cpp +++ b/hgmarkdownhighlighter.cpp @@ -206,9 +206,9 @@ void HGMarkdownHighlighter::parseInternal() if (len == 0) { return; } else if (len >= capacity) { - resizeBuffer(qMax(2 * capacity, len + 1)); + resizeBuffer(qMax(2 * capacity, len * 2)); } else if (len < (capacity >> 2)) { - resizeBuffer(qMax(capacity >> 1, len + 1)); + resizeBuffer(qMax(capacity >> 1, len * 2)); } memcpy(content, data, len);