diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index fd7f2f0ef..8d96280e9 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -222,12 +222,13 @@ void Text::regenerate() if(!doc) { doc = DocumentCache::getInstance().pop(); - doc->setDefaultFont(defFont); dirty = true; } if(dirty) { + doc->setDefaultFont(defFont); + if(!elide) doc->setHtml(text); else @@ -238,9 +239,8 @@ void Text::regenerate() opt.setWrapMode(elide ? QTextOption::NoWrap : QTextOption::WrapAtWordBoundaryOrAnywhere); doc->setDefaultTextOption(opt); - // width & layout + // width doc->setTextWidth(width); - doc->documentLayout()->update(); // update ascent if(doc->firstBlock().layout()->lineCount() > 0) diff --git a/src/chatlog/documentcache.cpp b/src/chatlog/documentcache.cpp index d78301fab..093fa7ece 100644 --- a/src/chatlog/documentcache.cpp +++ b/src/chatlog/documentcache.cpp @@ -34,7 +34,10 @@ QTextDocument* DocumentCache::pop() void DocumentCache::push(QTextDocument *doc) { if(doc) + { + doc->clear(); documents.push(doc); + } } DocumentCache &DocumentCache::getInstance()