From 5595570dfe5eca2d4842eddabb6117056d0ddbee Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 13 Jul 2015 14:08:17 +0300 Subject: [PATCH] optimized emoji insert --- Telegram/SourceFiles/gui/flattextarea.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/gui/flattextarea.cpp b/Telegram/SourceFiles/gui/flattextarea.cpp index 730c72bf1..36a9d430c 100644 --- a/Telegram/SourceFiles/gui/flattextarea.cpp +++ b/Telegram/SourceFiles/gui/flattextarea.cpp @@ -653,7 +653,14 @@ void FlatTextarea::onDocumentContentsChange(int position, int charsRemoved, int } if (charsAdded <= 0) return; - _insertions.push_back(Insertion(position, charsAdded)); + // _insertions.push_back(Insertion(position, charsAdded)); + _replacingEmojis = true; + QSizeF s = document()->pageSize(); + processDocumentContentsChange(position, charsAdded); + if (document()->pageSize() != s) { + document()->setPageSize(s); + } + _replacingEmojis = false; } void FlatTextarea::onDocumentContentsChanged() {