From 7d77002c538a1370173a93d1e8fb3dea1785272f Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 20 Oct 2016 21:54:56 +0800 Subject: [PATCH] change the policy of resizing the buffer when highlighting Signed-off-by: Le Tan --- hgmarkdownhighlighter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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);