From bf5a5fd5290e7233de89906efd02eef4cc996602 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Sat, 12 Mar 2016 19:38:17 +0300
Subject: [PATCH] fixed mentionsdropdown with pinned message display

---
 Telegram/SourceFiles/dropdown.cpp      |  6 +++---
 Telegram/SourceFiles/historywidget.cpp | 10 +++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp
index 0241da6b7..87d450196 100644
--- a/Telegram/SourceFiles/dropdown.cpp
+++ b/Telegram/SourceFiles/dropdown.cpp
@@ -4578,10 +4578,10 @@ void MentionsDropdown::recount(bool resetScroll) {
 	if (h > _boundings.height()) h = _boundings.height();
 	if (h > maxh) h = maxh;
 	if (width() != _boundings.width() || height() != h) {
-		setGeometry(0, _boundings.height() - h, _boundings.width(), h);
+		setGeometry(_boundings.x(), _boundings.y() + _boundings.height() - h, _boundings.width(), h);
 		_scroll.resize(_boundings.width(), h);
-	} else if (y() != _boundings.height() - h) {
-		move(0, _boundings.height() - h);
+	} else if (y() != _boundings.y() + _boundings.height() - h) {
+		move(_boundings.x(), _boundings.y() + _boundings.height() - h);
 	}
 	if (resetScroll) st = 0;
 	if (st != oldst) _scroll.scrollToY(st);
diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp
index 80137d8ec..ee0d57ae8 100644
--- a/Telegram/SourceFiles/historywidget.cpp
+++ b/Telegram/SourceFiles/historywidget.cpp
@@ -6193,11 +6193,15 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) {
 	_field.move(_attachDocument.x() + _attachDocument.width(), height() - kbh - _field.height() - st::sendPadding);
 
 	if (_pinnedBar) {
-		_scroll.move(0, st::replyHeight);
+		if (_scroll.y() != st::replyHeight) {
+			_scroll.move(0, st::replyHeight);
+			_attachMention.setBoundings(_scroll.geometry());
+		}
 		_pinnedBar->cancel.move(width() - _pinnedBar->cancel.width(), 0);
 		_pinnedBar->shadow.setGeometry(0, st::replyHeight, width(), st::lineWidth);
-	} else {
-		_scroll.move(0, _pinnedBar ? st::replyHeight : 0);
+	} else if (_scroll.y() != 0) {
+		_scroll.move(0, 0);
+		_attachMention.setBoundings(_scroll.geometry());
 	}
 
 	_attachDocument.move(0, height() - kbh - _attachDocument.height());